ios - 如何在 iphone 的 UITableview 单元格中设置文本位置数组

标签 ios iphone uitableview ios5 nsmutablearray

我有一个可变数组。我想在 UITableView 中设置文本框架。

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [appDelegate.UnitTypeAry objectAtIndex:indexPath.row];
cell.textLabel.frame = CGRectMake(10, 10, 150, 40);

最佳答案

您需要实现一个继承 UITableViewCell 的新类,并在单元格的 contentView 属性中添加标签。

更改标签的框架

-(void)layoutSubviews
{

}

你的新细胞类

关于ios - 如何在 iphone 的 UITableview 单元格中设置文本位置数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19994757/

相关文章:

iphone - 屏幕外的 UIScrollView 页面是否构成了很大的像素负担?

ios - NSInvalidArgumentException 所需类型 = NSString;给定类型 = __NSDictionaryM;值类型 Not Acceptable : property

iphone - 编辑时如何将图像叠加添加到UIImagePickerControllerSourceTypePhotoLibrary?

Swift TableView 插入新行

IOS Swift 表格 View :- How Display cell based on content?

ios - iOS 中使用 parse.com 的帖子评分系统 - 赞成/反对

iphone - 更新 Xcode 4.3 以支持 ios 5.1

iphone - 如何将 xcode 4.1 iPhone 应用程序转换为通用应用程序

iphone - 可能的 UITableViewCell UILabel 合成异常

ios - 如何以编程方式从 UITableView 中删除一行并更新 UI