サイドメニューがあるアプリがあります。サイド メニューでは、残りのボタンは正常に表示されますが、2 つのボタンが奇妙に伸びています。スクリーンショットを添付。
これは、ボタン画像を設定する方法です。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
RearViewTableViewCell *cell = [self.tableViewSideMenu dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if(cell == nil)
{
NSArray *cellView = [[NSBundle mainBundle] loadNibNamed:@"RearViewTableViewCell" owner:nil options:nil];
cell = (RearViewTableViewCell *)[cellView objectAtIndex:0];
cell.btnItemSelector.tag = indexPath.row;
[cell.btnItemSelector setBackgroundImage:[UIImage imageNamed:[buttonUnselect objectAtIndex:indexPath.row]] forState:UIControlStateNormal];
[cell.btnItemSelector setBackgroundImage:[UIImage imageNamed:[buttonSelect objectAtIndex:indexPath.row]] forState:UIControlStateHighlighted];
[cell.btnItemSelector addTarget:self action:@selector(btnMenuItemTapped:) forControlEvents:UIControlEventTouchUpInside];
cell.selectionStyle =UITableViewCellSelectionStyleNone;
}
return cell;
}
アダプティブレイアウトは初めてです。それは問題を引き起こしていますか?iPhone 5s では正常に動作しますが、iPhone 6 ではこの動作を示しています。テーブルビューに制約 (幅) を 1 つだけ追加しました。ここで使用している uitableviewcell (カスタム) には、先行スペース、垂直スペース、中央揃えなどのすべての通常の制約があります。何か考えはありますか?
更新: bg の色を赤に設定すると、質問の 2 つのボタンがサイズ変更されて、はるかに小さく、おそらくより広いビューになることがわかりました。なぜそれが起こるのでしょうか?