0
8.3模擬器上,以下代碼按預期包裝成多行;但在8.3 iPhone 6上運行時會截斷該行。Tableview word wrap在模擬器中工作,但不在設備上
下面是代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"Active Playlist";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.numberOfLines = 0;
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.textLabel.text = [playList objectAtIndex:indexPath.row];
return cell;
}
在您的建議;我嘗試過這個;沒有區別! –
使它工作的是指定字體大小;例如:[[cell textLabel] setFont:[UIFont systemFontOfSize:14.0]]; (但是,字體大小爲23失敗),所以它必須與高度有關-BUT-仍然存在這樣的問題:爲什麼它在模擬器中可以正常工作,而不是在IB中設置字體的設備。 –
本來是我的下一個猜測,設置字體。有時候設備和模擬器的行爲之間的差異真的很奇怪,但通常它是模擬器停止工作,而不是設備... 你試過(動態和)不同的單元格/文本標籤高度嗎? –