码迷,mamicode.com
首页 > 其他好文 > 详细

利用StoryBoard编写UITabelViewCell

时间:2014-10-23 20:29:16      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   ar   使用   for   sp   

举一个炒鸡简单的例子:

1 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
2     NSString *cellIdentifier = @"ContactCell";
3     HMContactRecordTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
4 //    [cell setInof:nil];
5     cell.nameLabel.text = @"皮卡丘";
6     cell.addressLabel.text = @"四川省成都市";
7     return cell;
8 }

以上是使用静态例子的方法。

1 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
2     return 20;
3 }

这时控制cell个数的函数,在这里写死,就20个。

bubuko.com,布布扣

在Identifier属性里,填上在上上个方法里的Identifier。

上上个方法里备注释掉的语句是写在自顶一个UITableViewCell类HMContactRecordTableViewCell中的方法。

- (void)setInof:(id)info {
    self.nameLabel.text = @"奥特曼";
    self.telLabel.text = @"15652965058";
    self.timeLabel.text = @"12:00";
    self.addressLabel.text = @"四川省成都市";
}

调用这个方法就可以实现设置了。

最后的效果图:

bubuko.com,布布扣

利用StoryBoard编写UITabelViewCell

标签:style   blog   http   color   io   ar   使用   for   sp   

原文地址:http://www.cnblogs.com/chaiwentao/p/4046568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!