重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、微信小程序、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了陵水黎族免费建站欢迎大家使用!
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
CellIdentifier];
if (0 == indexPath.section) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
if (0 == indexPath.row) {
cell.textLabel.text = @"好的"; //cell的text内容
UIView *lbl = [[UIView alloc] init]; //定义一个label用于显示cell之间的分割线(未使用系统自带的分割线),也可以用view来画分割线
lbl.frame = CGRectMake(cell.frame.origin.x + 10, cell.frame.size.height - 5, cell.frame.size.width - 20, 1);
lbl.backgroundColor = [UIColor lightGrayColor];
[cell.contentView addSubview:lbl];
[lbl release];
}
UILabel *label = [[UILabel alloc] init]; //定义一个在cell最右边显示的label
label.text = @"Dark0921";
label.font = [UIFont boldSystemFontOfSize:14];
[label sizeToFit];
label.backgroundColor = [UIColor clearColor];
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
label.frame =CGRectMake(SCREEN_WIDTH - label.frame.size.width - 10,\
12, label.frame.size.width, label.frame.size.height);
} else {
label.frame =CGRectMake(SCREEN_WIDTH - label.frame.size.width - 20,\
12, label.frame.size.width, label.frame.size.height);
}
[cell.contentView addSubview:label];
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor grayColor];
[label release];
}
else if (1 == indexPath.row){
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; //显示最右边的箭头
cell.textLabel.text = @"添加好友";
}
}
return cell;
}