我正在添加以下代码来添加带有按钮的页脚以执行操作。我无法将按钮重新调整为单元格的大小。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
}
谁能帮我解决这个问题