- 新建cell 继承自BaseBorderCell
#import <UIKit/UIKit.h>
#import "BaseBorderCell.h"
@interfaceMTQuestionnaireCell : BaseBorderCell
@end
- 在新建cell中实现要自定义的控件
- 在控制器数据源方法中 设置边框样式
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
/*
你可以使用自己的初始化方法
BaseBorderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell = [[BaseBorderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
[cell setBorderStyleWithTableView:tableView indexPath:indexPath];
*/
//也可以这样子
BaseBorderCell*cell = [BaseBorderCellcellWithTableView:tableView indexPath:indexPath];
cell.contentBorderColor= [UIColorlightGrayColor];
cell.contentBackgroundColor= [UIColorwhiteColor];
cell.contentBorderWidth= 0.5;
cell.contentMargin= 10;
cell.contentCornerRadius= CGSizeMake(5, 5);
cell.textLabel.text= [NSStringstringWithFormat:@"section%ld--index%ld",(long)indexPath.section,(long)indexPath.row];
returncell;
}