UITableView 的 delegate2个基本方法
2011-08-24 11:07
316 查看
// 分区中有多少行 -(NSInteger ) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section { return [ self.listData count ]; } // 添加每一行的信息 - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *tag=@"tag" ; //MyClass 是自己实现的UITableViewCell , 包含一个label 和一个按钮 MyClass *cell=(MyClass *)[tableView dequeueReusableCellWithIdentifier:tag]; if (cell==nil ) { [[NSBundle mainBundle] loadNibNamed:@"Empty" owner:self options:nil]; // cell=[[[ MyClass alloc ] initWithFrame : CGRectZero // reuseIdentifier:tag] autorelease]; cell = cellClass; } NSUInteger row=[indexPath row ]; // cell.textLabel.text =[listData objectAtIndex :row]; CardType *ct = (CardType*)[self.listData objectAtIndex :row]; cell.infoLabel.text = ct.cardType; //给button设置文本的时候,必须同时设置按钮状态,否则无效 [cell.button setTitle: ct.cardID forState:UIControlStateNormal]; return cell; }
相关文章推荐
- iOS开发中UITableview控件的基本使用及性能优化方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- 转:UITableView 基本使用方法总结
- UITableView 基本使用方法总结
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UITableView 基本使用方法总结
- UITableView中的代理方法的含义以及它的基本属性
- UITableView基本使用方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- NSURLConnection和UITableView的delegate执行先后问题的解决方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UITableView总结:基本使用方法介绍
- UITableView 基本使用方法总结
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UIALertView的基本用法与UIAlertViewDelegate对对话框的事件处理方法
- UITableView的基本使用方法
- UITableView 系列一 :基本使用方法 (显示,删除,添加图片,添加样式等) (实例)