添加UITableViewController下的純代碼按鍵
-(void)binge_addSendBtns {
// 設(shè)置按鍵位置的參數(shù)
CGFloat viewW = self.view.bounds.size.width;
UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, viewW, 200)];
// 設(shè)置 footerView
self.tableView.tableFooterView = footerView;
UIButton *sendMsgBtn = [[UIButton alloc]init];
[sendMsgBtn addTarget:self action:@selector(sendMsg) forControlEvents:UIControlEventTouchUpInside];
// 按鍵顏色
[sendMsgBtn setBackgroundColor:[UIColor colorWithRed:50.0/255 green:180.0/255 blue:50.0/255 alpha:1]];
// 按鍵文字顏色
[sendMsgBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// 按鍵標(biāo)題
[sendMsgBtn setTitle:@"發(fā)消息" forState:UIControlStateNormal];
// 按鍵位置
sendMsgBtn.frame = CGRectMake(20, 0, viewW - 40, 44);
// 圓角
sendMsgBtn.layer.cornerRadius = 10;
// 切除/覆蓋多余的
sendMsgBtn.layer.masksToBounds = YES;
// [self.view addSubview:sendMsgBtn];
[footerView addSubview:sendMsgBtn];
}
- (void)viewDidLoad {
[super viewDidLoad];
//調(diào)用方法
[self binge_addSendBtns];
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。