Objective c 更改tableview的标签和图标位置';s细胞
是否可以更改我的tableview单元格的图像和标签的位置? 我不会使用CustomCell 我试过这个(为了标签)Objective c 更改tableview的标签和图标位置';s细胞,objective-c,uitableview,uiimageview,uilabel,Objective C,Uitableview,Uiimageview,Uilabel,是否可以更改我的tableview单元格的图像和标签的位置? 我不会使用CustomCell 我试过这个(为了标签) }请选取一个UIview..并给出与单元格大小相同的框架大小…在该视图中添加标签…以及您要添加的任何内容..在该视图中添加子视图…而不是在单元格中添加该视图 最好的您可以参考此文档。它包括默认单元格和自定义单元格。 //table cell contains title,date,image - (UITableViewCell *)tableView:(UIT
}请选取一个UIview..并给出与单元格大小相同的框架大小…在该视图中添加标签…以及您要添加的任何内容..在该视图中添加子视图…而不是在单元格中添加该视图 最好的您可以参考此文档。它包括默认单元格和自定义单元格。
//table cell contains title,date,image
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell =nil;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
}
//tittle label
UILabel *titleLabel = [[UILabel alloc] initWithFrame:contentFrame] ;
titleLabel.numberOfLines = 2;
titleLabel.font = [UIFont boldSystemFontOfSize:12];
titleLabel.text = [currentTweet title];
[cell.contentView addSubview:titleLabel];
//date label
UILabel *dateLabel = [[UILabel alloc] initWithFrame:dateFrame];
dateLabel.font = [UIFont systemFontOfSize:10];
dateLabel.text = [currentTweet dateCreated];
[cell.contentView addSubview:dateLabel];
//image view
CGRect imageFrame = CGRectMake(2, 8, 40,50);
self.customImage = [[UIImageView alloc] initWithFrame:imageFrame];
customImage.image =image;
[cell.contentView addSubview:self.customImage];
return cell;
//table cell contains title,date,image
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell =nil;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
}
//tittle label
UILabel *titleLabel = [[UILabel alloc] initWithFrame:contentFrame] ;
titleLabel.numberOfLines = 2;
titleLabel.font = [UIFont boldSystemFontOfSize:12];
titleLabel.text = [currentTweet title];
[cell.contentView addSubview:titleLabel];
//date label
UILabel *dateLabel = [[UILabel alloc] initWithFrame:dateFrame];
dateLabel.font = [UIFont systemFontOfSize:10];
dateLabel.text = [currentTweet dateCreated];
[cell.contentView addSubview:dateLabel];
//image view
CGRect imageFrame = CGRectMake(2, 8, 40,50);
self.customImage = [[UIImageView alloc] initWithFrame:imageFrame];
customImage.image =image;
[cell.contentView addSubview:self.customImage];
return cell;