您的位置:首页 > 移动开发 > IOS开发

IOS 改变按钮标题位置和缩进

2016-03-16 10:10 381 查看
UIButton *missGesturebtn = [UIButton buttonWithType:UIButtonTypeCustom];
missGesturebtn.frame = CGRectMake(0, CGRectGetMaxY(_editGesturebtn.frame)+20, SCREEN_WIDTH, 40);
[missGesturebtn setTitle:@"忘记手势密码" forState:UIControlStateNormal];
[missGesturebtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
missGesturebtn.backgroundColor = [UIColor whiteColor];
missGesturebtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;//左对齐
missGesturebtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);//上,左,下,右
[missGesturebtn addTarget:self action:@selector(missGesture) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:missGesturebtn];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息