您的位置:首页 > 产品设计 > UI/UE

IOS--UITableView,UITableViewCell介绍

2014-07-02 23:45 295 查看

一,UITableView

1.UITableView继承自UIScrollView,可以分为Plain和Grouped两种风格。

例:

UITableView *aView = [[UITableView
alloc]initWithFrame:CGRectMake(0,
0, 320,
self.view.frame.size.height
- 64)
style:UITableViewStylePlain];

2.在UITableView的帮助文档中得到有两个协议,必须遵循 UITableViewDataSource,UITableViewDelegate,并且实现这个协议:
例:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath

二,UITableViewCell

 
   我们可以通过cell的selectionStyle属性指定cell选中时的显示风格,以及通过accessoryType来指定cell右边的显示的内容,或者直接指定accessoryView来定制右边显示的view。

   

系统提供的UITableView也包含了四种风格的布局:
    例:
typedef
NS_ENUM(NSInteger, UITableViewCellStyle) {

    UITableViewCellStyleDefault,

    UITableViewCellStyleValue1,

    UITableViewCellStyleValue2,

    UITableViewCellStyleSubtitle

};

三,其他

代码报错之一:EXC_BAD_ACCESS ....  过度释放导致的崩溃。

int 转化 字符串 :stringWithFormat
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: