简体   繁体   中英

iOS7 tableView footer height

I am currently trying to learn some iOS app development, and facing this problem which I am unable to fix till now.

I have tried looking around, and got told that this will do the trick, but it dosn't seem to help me in my case.

view.frame = CGRectMake(80.0, 210.0, 160.0, 140.0);

Anyways, here is the full code :

- (UIButton *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
UIButton *view = [UIButton buttonWithType:UIButtonTypeRoundedRect];;
if (section == [tableView numberOfSections] - 1) {
    // This UIView will only be created for the last section of your UITableView
    [view setBackgroundColor:[UIColor colorWithRed:(236/255.0) green:(127/255.0) blue:(55/255.0) alpha:1]];
    view.titleLabel.font = [UIFont systemFontOfSize: 15 ];
    [view setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [view addTarget:self
               action:@selector(aMethod:)
     forControlEvents:UIControlEventTouchUpInside];
    [view setTitle:@"LOGIND" forState:UIControlStateNormal];
    view.frame = CGRectMake(80.0, 210.0, 160.0, 140.0);

}
return view;

}

Need guidance on what could be going wrong here. Thanks in advance.

use following method for passing height for footer in section

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  return 140.0;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM