アクションを実行するボタンを含むフッターを追加するために、次のコードを追加しています。ボタンのサイズをセルのサイズに変更できません。CGRectMake(0, 0, 300,44) 値の変更は、フッターの変更に影響を与えていません。より多くのセッションを持つテーブルを使用しています。すべてのセッションのフッターが必要ない代わりに、テーブルの最後に必要なので、次のコードを挿入しました。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath
{
//...
footerView = [[UIView alloc] init];
UIButton* Logoutbutton = [UIButton buttonWithType:UIButtonTypeCustom];
[Logoutbutton setTitle:@"Logout" forState:UIControlStateNormal];
NSLog(@"cell width : %d",cell.contentView.frame.size.width);
[Logoutbutton setFrame:CGRectMake(0, 0, 300,44)];
[Logoutbutton setBackgroundImage:[UIImage imageNamed:@"LogoutBgImage.png"]
forState:UIControlStateNormal];
[Logoutbutton setBackgroundColor:[UIColor clearColor]];
[Logoutbutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[Logoutbutton addTarget:self action:@selector(LogoutbuttonPressed:)
forControlEvents:UIControlEventTouchUpInside];
Settingstable.tableFooterView = Logoutbutton;
return cell;
}
- (void)LogoutbuttonPressed: (UIButton*) button
{
//some action
}
誰でもこの問題を解決するのを手伝ってくれますか