2017-06-15 3 views
0

viewForFooterInSection wird nicht am unteren Bildschirmrand angezeigt (uitableview). Hier verwende ich UItableview. imageviewForFooterInSection wird nicht am unteren Bildschirmrand angezeigt

Hinweis: Im unteren Bildschirmbereich kann der untere Bildschirmrand um eine weitere Fußzeile erweitert werden (weiße Farbansicht). Redcolorview: Fußzeile (von unten Code) blaue Farbe: Tabelle Hintergrundfarbe weiß Boden:

Rote Farbansicht ich programmatisch hinzugefügt, unter Code verwendet:

- (CGFloat)tableView:(UITableView *)tableView 
estimatedHeightForFooterInSection:(NSInteger)section 
{ 
    return 44; 
} 
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 
{ 
    NSLog(@"%f",tableView.frame.size.width); 

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 44)]; 
    view.backgroundColor = [UIColor redColor]; 
    UIButton *cancelButton = [[UIButton alloc]initWithFrame:CGRectMake(30, 7, tableView.frame.size.width/2 - 60, 30)]; 
    [cancelButton setTitle:@"Cancel" forState:UIControlStateNormal]; 
    [cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
    [cancelButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(@"pothysapp_label_text_backgroundcolor",@"ApplicationSettings",[NSBundle mainBundle], nil)]]; 
    [cancelButton addTarget:self 
        action:@selector(cancelDetails:) 
      forControlEvents:UIControlEventTouchUpInside]; 
    cancelButton.titleLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:15]; 
    cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 
    [view addSubview:cancelButton]; 

    UIButton *saveButton = [[UIButton alloc]initWithFrame:CGRectMake(tableView.frame.size.width/2 + 30, 7, tableView.frame.size.width/2 - 60, 30)]; 
    [saveButton setTitle:@"Save" forState:UIControlStateNormal]; 
    [saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
    [saveButton setBackgroundColor:[ValidationsClass colorWithHexString:NSLocalizedStringFromTableInBundle(@"pothysapp_label_text_backgroundcolor",@"ApplicationSettings",[NSBundle mainBundle], nil)]]; 
    [saveButton addTarget:self 
        action:@selector(saveDetails:) 
     forControlEvents:UIControlEventTouchUpInside]; 
    saveButton.titleLabel.font = [UIFont fontWithName:@"Roboto-Bold" size:15]; 
    saveButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter; 
    [view addSubview:saveButton]; 

    return view; 
} 
+0

Fußzeile Abschnitt auf der Unterseite nicht von der Tabellenansicht Abschnitt erscheint, wenn Ihr Abschnitt genügend Zellen Bildschirm zu decken hat. – dip

+0

Überprüfen Sie den folgenden Link es könnte nützlich für Sie sein https://Stackoverflow.com/a/7238601/5184217 –

Antwort

1

dieses Versuchen Sie stattdessen Ihre benutzerdefinierte Ansicht der Rückkehr in viewForFooterInSection.

Fügen Sie Ihre benutzerdefinierte Ansicht Tabellenfuß in viewDidLoad()

self.tableview.tableFooterView =//Your CustomView; 
+0

Vielen Dank, es funktioniert gut –

0

I entfernt estimatedHeightForFooterInSection und viewForFooterInSection.

Statt dem hinzugefügt i Blick in viewDidLoad: self.tableview.contentInset = UIEdgeInsetsMake(0, 0, -20, 0);

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 15, self.view.frame.size.width, 30)]; 
view.backgroundColor = [UIColor whiteColor]; 
self.tableview.tableFooterView = view; 

UIButton *cancelButton = [[UIButton alloc]initWithFrame:CGRectMake(30, 7, self.view.frame.size.width/2 - 60, 30)]; 
[cancelButton setTitle:@"Cancel" forState:UIControlStateNormal]; 
[cancelButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[view addSubview:cancelButton]; 

UIButton *saveButton = [[UIButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2 + 30, 7, self.view.frame.size.width/2 - 60, 30)]; 
[saveButton setTitle:@"Save" forState:UIControlStateNormal]; 
[saveButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 
[view addSubview:saveButton]; 
Verwandte Themen