您好,登录后才能下订单哦!
UI初级中的控件是UI学习的最基本的应用,下面是一些最基础的控件的应用
#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];
}
#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 redColor] forState:UIControlStateNormal];
// [button setTitleColor:[UIColor yellowColor] forState:UIControlStateSelected];
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
开发者交流群:
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。