cell的常用属性
来源:互联网 发布:u盘安装linux centos7 编辑:程序博客网 时间:2024/06/05 14:29
AppDelegate设置根视图控制器
RootViewController.h
@interface RootViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>{ NSArray *_data;}
RootViewController.m
- (void)viewDidLoad{ [super viewDidLoad]; //创建表视图 UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20, 320, 460) style:UITableViewStylePlain]; tableView.dataSource = self; tableView.delegate = self; //将表视图添加到根视图上 [self.view addSubview:tableView]; [tableView release]; //创建显示数据 _data = [[UIFont familyNames] retain];}#pragma mark - UITableView datasource- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _data.count;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *iden = @"Cell_11"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:iden]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:iden] autorelease]; /*__________________________________cell的常用属性_______________________________________*/ //cell的label背景颜色 cell.textLabel.backgroundColor = [UIColor clearColor]; //1.cell的背景设置 //将图片设置成背景可以不设置frame UIImageView *bkImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tableCell_common"]]; cell.backgroundView = bkImg; [bkImg release]; //2.设置选中后显示的图片 UIImageView *bkImg_Tap = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tableCell_common_tapped"]]; cell.selectedBackgroundView = bkImg_Tap; [bkImg_Tap release]; //3.设置cell的选中效果// cell.selectionStyle = UITableViewCellSelectionStyleNone; //取消选中效果 //4.设置cell在选中的时候label的字体样式 cell.textLabel.highlightedTextColor = [UIColor whiteColor]; //5.设置cell的辅助图标// cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; //6.自定义辅助图标 UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; view.backgroundColor = [UIColor greenColor]; cell.accessoryView = view; [view release]; //当cell被选中后,cell上所有的子视图背景变成透明的 } cell.textLabel.text = _data[indexPath.row]; return cell;}//点击<strong><span style="color:#ff0000;">辅助图标</span></strong>相应事件- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{ NSLog(@"test");}
0 0
- cell的常用属性
- UITableView Cell一些常用的属性
- UITableView Cell的属性方法
- cell的一些属性设定
- tableView 的 cell 和 cell 的 imageView 的属性
- cadence中cell属性值的传递
- js对cell一些属性的控制
- CELL (华表)组件的Property属性
- CSS:Table-cell属性的妙用
- iOS中cell的属性设置
- 获得tableview某个cell的属性的值的方法
- ios中视图中Cell的属性或方法
- StoryBoard中tableView中cell的各个属性说明
- iOS—TableView之Cell的Style属性
- iOS UITabelViewCell点击获得cell的text属性值
- UIScrollView属性以及tableVIew自动点击cell的方法
- Tableview-cell目前有用到的一些属性
- UITableViewCell 分割线的属性 cell两端置顶 缩进 颜色
- Web.xml配置详解之context-param
- poj 3613 Cow Relays
- Aspect Oriented Programming with Spring
- listview item设置间距无效与去掉默认黄色的selector
- ios 用了svn管理代码,项目文件越来越大,远超出实际代码文件大小
- cell的常用属性
- linux shell编程中的特殊符号
- fseek,ftell,ftruncate,fsetpos,fgetpos简介
- 利用RANSAC算法筛选SIFT特征匹配
- activity-alias的使用
- 如何调试异步加载的js文件
- Java应用中的编码问题 .
- ubuntu加入静态IP
- 函数指针和指针函数的区别