首页 > 其他 > 详细

按钮小结1

时间:2015-04-16 21:29:07      阅读:211      评论:0      收藏:0      [点我收藏+]

按钮这个空间我非常的讨厌,用代码写很恶心

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 50, 50);
//    button.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds));
    [button setTitle:@"转换转换转换" forState:UIControlStateNormal];
    [button setBackgroundColor:[UIColor whiteColor]];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(turnToAnotherController:) forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:button];

这是一段简单示例,其中

设置title 只能用 setTitle: 方法

设置字体颜色也只能用对应方法 

button有个textlabel 那个是只读 设置任何都没用的

 

 

按钮小结1

原文:http://www.cnblogs.com/qiqingnan/p/4433111.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!