本文主要是介绍UITableViewStyle设置Group、Plain问题,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、当创建UIViewController添加UITableView时,
self.tableView =[[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
2、当创建UITableViewController时,需要改变UITableViewStyle时,
使用self.tableView.style = UITableViewStyleGrouped; 会出现错误
ps:
@property (nonatomic, readonly) UITableViewRowActionStyle style;
UITableViewStylePlain和UITableViewStyleGrouped是UITableViewStyle类型。
查UITableViewController的SDK文档,发现:
Table views can have one of two styles, UITableViewStylePlain and UITableViewStyleGrouped. When you create a UITableView instance you must specify a table style, and this style cannot be changed.
可以在Xib文件的属性下直接修改为Group或Plain。
这篇关于UITableViewStyle设置Group、Plain问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!