2013-10-09 56 views
0

我正在向UITableViewController添加UIView(作爲容器視圖)。出於某種原因,UITableView分隔符通過UIView可見。我運行iOS 7.除非你把它下面的頁腳視圖的UITableView平局分隔線以及爲什麼UITableViewSeparator通過UIView可見?

UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 200, self.view.width, 50)]; 
container.opaque = YES; 
container.backgroundColor = [UIColor colorWithRed:224.0/255.0 green:224.0/255.0 blue:224.0/255.0 alpha:1.0]; 
[self.view container]; 

回答

1

試試這個在viewDidLoad中的UITableViewController

self.tableView.tableFooterView = [UIView new]; 

的。爲了消除他們要麼你可以將其設置爲空的觀點,因爲我上面那樣還是

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section  { 
    // This will create a "invisible" footer 
    return 0.01f; 
} 

OR

集separatorStyle到UITableViewCellSeparatorStyleNone

+0

奏效!你介意解釋爲什麼? – mergesort

+0

檢查我更新的答案 – msk