UITableView的使用
2015-11-17 21:33
405 查看
UITableView的使用
在使用tableview时注意以下几点:1、需要在自定义cell里面写以下代码初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) <span style="font-family: Arial, Helvetica, sans-serif;"> </span>
[self p_setupViews];// 布局,写在下面 } return self; }
2、 自定义cell 的高度
+(CGFloat)MusicListcellHeight;// 在cell.m文件里
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath // 这个方法写在controller的cell高度里 { return [MusicCell MusicListcellHeight]; }
3、 cell的注册 这个经常忘 不注册的话会报错
'unable to dequeue a cell with identifier musiccell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'[self.tableView registerClass:[MusicCell class] forCellReuseIdentifier:@"musiccell"];
相关文章推荐
- 19.UISegmentedControl(分段按钮)
- 爬爬爬之路:UI(六) UISegmentedControl UISlider NSTimer的简单应用
- Implement Stack using Queues leetcode oj java
- LeetCode Longest Increasing Subsequence
- UI基础-UIControl及其子类
- 18.UIStepper
- 随意细解:UI -- UISegmentedControl、UISlider
- UEFI的helloworld程序
- LeetCode OJ:Longest Increasing Subsequence(最长递增序列)
- Machine Learning week 3 quiz : Regularization
- UVA 11995 - I Can Guess the Data Structure!【stl】
- 在uistoryboard中实现scrollView的添加内容的操作注意事项
- poj 2593Max Sequence【dp】
- mac os slave Slave went offline during the build issue
- My 1st webUI try
- UISegmentedControl 分段控制 一个小demo
- 《iOS Human Interface Guidelines》——Integrating with iOS
- UI 第六天 UISegmentControl UISlider UIImageView
- Frequently Asked Questions in Spark
- UI note1