iOS tableView~尾部添加控件

//联系人:石虎QQ:1224614774昵称:嗡嘛呢叭咪哄

/**

注意:在cell的最后一行添加文案

*/

一、效果图:

iOS tableView~尾部添加控件_第1张图片

二、代码实现

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section

{

//底部文案

CGFloat bottomViewH =30;

UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0,self.view.bounds.size.height -80,OK_SCREEN_WIDTH, bottomViewH)];

if(section ==0) {

bottomView.backgroundColor = [UIColor clearColor];

}else{

bottomView.backgroundColor = OKColorRGBA(188,154,99,0.1);

}

[self.view addSubview:bottomView];

//文案

UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0,8,0,0)];

titleLabel.font = kGlobalFontSize_13;

titleLabel.text =@"八方贵金属合作机构均有国家监管保障";

titleLabel.textAlignment = NSTextAlignmentCenter;

[titleLabel sizeToFit];

titleLabel.ok_centerX =self.view.ok_centerX;

titleLabel.textColor = kGlobalButtonYellow;

[bottomView addSubview:titleLabel];

//图片

UIImageView *LeftImage = [[UIImageView alloc] initWithFrame:CGRectMake(titleLabel.mj_x-20,8, titleLabel.ok_height, titleLabel.ok_height)];

LeftImage.image = [UIImage imageNamed:@"img_shield_shield"];

[bottomView addSubview:LeftImage];

returnbottomView ;

}

谢谢!!!

你可能感兴趣的:(iOS tableView~尾部添加控件)