Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Tableview word wrap可以在模拟器中工作,但不能在设备上工作_Ios_Objective C_Iphone_Ios Simulator_Tableview - Fatal编程技术网

Ios Tableview word wrap可以在模拟器中工作,但不能在设备上工作

Ios Tableview word wrap可以在模拟器中工作,但不能在设备上工作,ios,objective-c,iphone,ios-simulator,tableview,Ios,Objective C,Iphone,Ios Simulator,Tableview,以下代码在8.3模拟器上按预期换行到多行;但在8.3版iPhone 6上运行时会截断线路 代码如下: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"Active Playlist"; UITableViewCell *cell

以下代码在8.3模拟器上按预期换行到多行;但在8.3版iPhone 6上运行时会截断线路

代码如下:

- (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;
}

您是否尝试过将两个负责的对齐放在if语句中,以便仅在单元启动时调用它们

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];

    cell.textLabel.numberOfLines = 0;
    cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
}

根据你的建议;我试过了;没什么区别!使它工作的是指定字体大小;e、 g.:[[cell textLabel]setFont:[UIFont systemFontOfSize:14.0]];(然而,字体大小为23是不行的),因此,它一定与高度有关——但是——这仍然引出了一个问题,为什么它在模拟器中工作良好,而不是在IB中设置的字体下的设备。我的下一个猜测是,设置字体。有时,设备和模拟器之间的行为差异真的很奇怪,但通常是模拟器停止工作,而不是设备。。。您是否尝试过(动态和)不同的单元格/文本标签高度?