①在自定义tableView.h文件中,添加属性
②在tableview.m的interface中声明代理
③在.m中的initWithFrame方法内部设置table的代理以及添加tableViewFrame的set方法
-(
void
)setTableViewFrame:(CGRect)tableViewFrame
{
self.frame = tableViewFrame;
// 设置tableView的frame为所传值
}
在所需要添加的ViewController中添加tableView,在ViewController.m方法中对数据其进行初始化
table = [[general_table_view alloc] initWithFrame:CGRectMake(0, 20, 320, self.view.frame.size.height-20) style:UITableViewStylePlain];
// 设置数据源
table.textLabel_Array = [[NSMutableArray alloc] initWithObjects:@
""
,@
""
,@
""
,@
""
,@
""
,@
""
, nil];
[self.view addSubview:table];
// 添加到当前View
在建立一个button后要手动设置一下它的imageView.hidden和imageView.frame属性,方可正常显示图 self.shareBtn.imageView.frame = self.shareBtn.bounds;
self.shareBtn.hidden = NO;
在iOS8系统下,UITabbar上的item自定义背景色和图片,初始设置了红色没效果系统默认颜色-蓝色