首页 > 其他 > 详细

利用StoryBoard编写UITabelViewCell

时间:2014-10-23 20:28:41      阅读:280      评论:0      收藏:0      [点我收藏+]

举一个炒鸡简单的例子:

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!