2015-07-09 27 views
2

這是我用tableviewcontroller設置的基本tableview。重用標識符只是獲得淺綠色的原型單元格。同時使用TableFooterView和行操作的TableView分隔符的奇怪行爲

#import "ViewController.h" 

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib 
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 25)]; 
    [self.tableView.tableFooterView setBackgroundColor:[UIColor colorWithRed:215/255 green:1 blue:1 alpha:1]]; 
} 

- (BOOL) tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 
    return YES; 
} 

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { 
    UITableViewRowAction *removeFolderRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault 
                       title:@"hi" 
                       handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) 
               { 
                return; 
               }]; 

    return @[removeFolderRowAction]; 
} 

- (void) tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 
    return; 
} 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
    return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return 4; 
} 

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    return [self.tableView dequeueReusableCellWithIdentifier:@"cell"]; 
} 

@end 

這會產生這種流動:

enter image description hereenter image description hereenter image description hereenter image description here

它沒有底部隔離開始,然後如果你到編輯模式的最後一個單元格還有沒有底分離,但是編輯完成後,會出現一個完整寬度的分隔符,如果再次進入編輯模式則會出現全分隔符。如果我要讓我的tableFooterView成爲CGRectZero框架的視圖,它將以預期的方式運行(有一個分隔符,與所有其他分隔符相同,在進入編輯模式時不會移動),但只要tableFooterView有一些高度,它可以回到上面的圖片。

+0

您是否發現問題?我有這個問題 –

回答

1

所以我挖了一下,ios 11爲我解決了這個問題。似乎是以前版本中的錯誤。 對於我來說,分隔符會顯示在觸摸頁眉或頁腳的最後一行中

+0

除非任何人進來併發布如何在以前的版本中修復它,否則Well sick接受這個問題,但自從2年來我懷疑它會發生。 –