标签:uibutton
如下图:
UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
leftBtn.frame = CGRectMake(0, 0, 40, 35);
//<* button的的图片和文字居中 *>
leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
//<* 设置title的向左偏移35 *>
[leftBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -35, 0, 0)];
[leftBtn setImage:[UIImage imageNamed:@"icon_homepage_downArrow"] forState:UIControlStateNormal];
leftBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
[leftBtn setTitle:@"上海" forState:UIControlStateNormal];
NSTextAlignmentLeft;
leftBtn.titleLabel.font = kFONT10;
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:uibutton
原文地址:http://blog.csdn.net/tubiebutu/article/details/48132607