我創建一個UITableView和UITable視圖爲textLabel寫了下面的代碼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;
,你可以從上面的代碼明白,我有命名爲靜態場景一個的tableview細胞爲textLabel 。
in this code [cell.textLabel setFrame:CGRectMake(200,20,500,600)];我打算設置textLabel框架,但它不根據我設置的框架來調整大小。我用這個cell.textLabel.frame = CGRectMake(200,20,500,600)代碼也是。 任何人都可以告訴我一個重新調整文本標籤大小的好方法。
如果有任何答案有幫助,您應該接受它。如果您需要關於此問題的進一步幫助,請提及它。 – 2011-06-19 18:13:43