【发布时间】:2011-06-16 05:45:44
【问题描述】:
我创建了一个 UITableView 并在 cellForRowAtIndexPath
static NSString *CellIdentifier = @"RootViewControllerCellIdentifier";
UITableViewCell *cell = [self.tableView queueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
}
// Set appropriate labels for the cells.
switch (indexPath.row) {
case 0:
cell.textLabel.text = @"Static Scenes";
**[cell.textLabel setFrame:CGRectMake(200, 20, 500,600)];**
cell.imageView.image=[UIImage imageNamed:@"RunOptionsImage.png"];
cell.imageView.frame=CGRectMake(15, 20, 55, 65);
break;
从上面的代码可以理解,我有一个名为 Static Scenes 的 tableview 单元格 textLabel。
在这段代码中 [cell.textLabel setFrame:CGRectMake(200, 20, 500,600)]; 我打算设置 textLabel 的框架。但它不会根据我设置的框架调整大小。 我也使用了这个 cell.textLabel.frame = CGRectMake(200, 20, 500,600) 代码。 谁能告诉我调整文本标签大小的好方法。
【问题讨论】:
-
如果任何答案有帮助,您应该接受它。如果您在此问题上需要任何进一步的帮助,请提及。
标签: cocoa-touch ipad uitableview textlabel