インターフェイスビルダーで既存のビューにテーブルビューを追加できますか?
私のインターフェースビルダーは次のようになります
しかし、シミュレーターでコードを実行すると、下部のボタンをオーバーレイするため、テーブルがインターフェースビルダーと同じ場所に表示されないことがわかります???
更新...私は一種の進歩を遂げていますが、下部のボタンは隠されています??
FIXED ...アドバイスに従って次のコードを使用します:)
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 40)];
view.backgroundColor = [UIColor whiteColor];
UIButton *buttonA = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonA.frame = CGRectMake(101,5,118,29);
[buttonA setTitle:@"Save & Exit" forState:UIControlStateNormal];
buttonA.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[view addSubview:buttonA];
UIButton *buttonB = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonB.frame = CGRectMake(254,5,56,29);
[buttonB setTitle:@"Next" forState:UIControlStateNormal];
buttonB.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[view addSubview:buttonB];
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return 40;
}