1
tableViewの内部にあるUIViewの高さを変更しようとしています。 UIViewの高さがセルの高さを超えてはいけません。UITableViewCellの中にあるUIViewの高さを変更する
私はview
の境界を設定しようとしましたが、ビューには影響しませんでした。私はこの問題を解決し、view
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
UIView *view=(UIView *)[cell viewWithTag:999];
view.backgroundColor=[UIColor redColor];
[view setBounds:CGRectMake(view.bounds.origin.x, view.bounds.origin.y, view.bounds.size.width, 400)];
return cell;
}
しかし、背景色は期待どおりに変更されました – gamal
ビューに関連するテーブルセルの高さを増やす必要があります。自動レイアウトを使用している場合は、レイアウト制約を使用します。 –
cellForRowAtIndexPath内のレイアウト制約にアクセスする方法を説明できます – gamal