我有一張表。表有一個簡單的自定義單元格。這個單元格中只有標籤。 這裏是cellForRow功能的代碼:無法更改UITableviewCell子類中的子視圖位置
MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.myLabel.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row];
cell.myLabel.frame = CGRectOffset(cell.myLabel.frame, 0, -20);
cell.myLabel.backgroundColor = [UIColor redColor];
return cell;
一切工作正常,除了這一點:
cell.myLabel.frame = CGRectOffset(cell.myLabel.frame, 0, -20);
標籤不想動! 我在iOS8中發現了這個問題。
任何人的幫助,請:)
在 MyCell.m
這是最好的答案 – 2015-07-24 08:48:01