UI中控件的应用

发布时间:2020-04-01 02:48:33 作者:jna_114
阅读:484
开发者专用服务器限时活动,0元免费领! 查看>>

UI初级中的控件是UI学习的最基本的应用,下面是一些最基础的控件的应用

UILabel  

#pragma mark -UILabel

- (void)_initLabel

{

    textLable.backgroundColor = [UIColor grayColor];

    textLable.text = @"good morning hehehehehe good morning hehehehehe";

    textLable.font = [UIFont systemFontOfSize:16];

    textLable.font = [UIFont boldSystemFontOfSize:16];

    textLable.font = [UIFont fontWithName:@"Zapf Dingbats" size:16];

    textLable.textColor = [UIColor orangeColor];

    textLable.textAlignment = NSTextAlignmentCenter;

    textLable.numberOfLines = 0;

    [textLable sizeToFit];

//    NSLog(@"textLabel is %@", textLable);

    [self.window addSubview:textLable];

}

UIButton

#pragma mark -UIButton

- (void)_initButton

{

    button.frame = CGRectMake(10, 180, 90, 44);

    button.backgroundColor = [UIColor greenColor];

//    button.titleLabel.text = @"hehe";   //错误,不能这样设置title

     typedef NS_OPTIONS(NSUInteger, UIControlState) {

     UIControlStateNormal       = 0,

     UIControlStateHighlighted  = 1 << 0,                  // used when UIControl isHighlighted is set

     UIControlStateDisabled     = 1 << 1,

     UIControlStateSelected     = 1 << 2,                  // flag usable by app (see below)

     UIControlStateApplication  = 0x00FF0000,              // additional flags available for application use

     UIControlStateReserved     = 0xFF000000               // flags reserved for internal framework use

     };

     */

    [button setTitle:@"hehe" forState:UIControlStateNormal];

//    [button setTitle:@"haha" forState:UIControlStateHighlighted];

//    [button setTitle:@"hihi" forState:UIControlStateSelected];

//    button.selected = true;

    button.titleLabel.font = [UIFont boldSystemFontOfSize:20];

    [button setTitleColor:[UIColor redColorforState:UIControlStateNormal];

//    [button setTitleColor:[UIColor yellowColor] forState:UIControlStateSelected];

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:
  1. 如何使用JavaScript UI控件(WijmoJS)构建
  2. iOS-UI-基本控件之UISwitch

开发者交流群:

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

label

上一篇:centos7安装出现license information(license not accepted)解决办法

下一篇:强力推荐,HTML5与JQuery结合的幻灯片

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
开发者交流群×