の最後にさらにロードボタンを追加したいと思いますUITableview
。Instagramのload-moreボタンと同じ機能があります。これが写真です。
だから私の質問は、最後にそれを追加する方法UITableview
ですか?テーブルビューはスクロール可能であるため、ボタンに動的な位置を設定する方法がわかりません。
前もって感謝します。
の最後にさらにロードボタンを追加したいと思いますUITableview
。Instagramのload-moreボタンと同じ機能があります。これが写真です。
だから私の質問は、最後にそれを追加する方法UITableview
ですか?テーブルビューはスクロール可能であるため、ボタンに動的な位置を設定する方法がわかりません。
前もって感謝します。
空の UIViewUIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 70)];
を作成します: ボタンを作成します:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Load More" forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonLoadMoreTouched) forControlEvents:UIControlEventTouchUpInside];
[button sizeToFit];
1 のビューのサブビューとしてボタンを追加します。
[v addSubview:button];
テーブルのtableFooterView
プロパティを 1 からのビューに設定します。
self.myTableView.tableFooterView = v;
すべてのUITableViewにはfooterViewプロパティがあります。カスタムfooterViewを作成し、プロパティを設定するだけです
@property(nonatomic, retain) UIView *tableFooterView
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
上記の方法でボタンを追加し、以下の方法でフッターを必要なサイズに設定できます
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
お役に立てれば。