相关疑难解决方法(0)

自动布局UILabels

UILabels我的习惯中有三个UITableViewCell.可能有些UILabels会是空的(label.text == @"")

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"EventCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];


        NSString *key = [[keysArray objectAtIndex:indexPath.section] description];

        UILabel *nameLabel = (UILabel *)[cell viewWithTag:100];
        namelabel.text = @"Label 1";

        UILabel *locationLabel = (UILabel *)[cell viewWithTag:101];
        location.text = @"Label 2";

        UILabel *timeLabel = (UILabel *)[cell viewWithTag:102];
        timeLabel.text = @"";

        return cell;
}
Run Code Online (Sandbox Code Playgroud)

如何UILabels使用自动布局将所有非空垂直居中放置在单元格中?

这是三个标签的外观

这是三个标签的外观:

如果其中一个UILables是空的,它看起来如何

当<code> UILables </ code>之一为空时,它的外观如何

这就是我希望它看起来的样子:

这就是我希望它看起来的样子:

xcode cocoa-touch ios autolayout ios6

5
推荐指数
1
解决办法
3933
查看次数

标签 统计

autolayout ×1

cocoa-touch ×1

ios ×1

ios6 ×1

xcode ×1