0
我在Xcode中用單個UITableViewController創建了一個新的單視圖項目(使用storyboard)。下面是設置代碼:自定義表格部分頁腳視圖 - 標籤不可見
- (void)viewDidLoad {
[super viewDidLoad];
_footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
_footerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UILabel *l = [[UILabel alloc] initWithFrame:CGRectMake(60, 0, 44, 44)];
l.text = @"Label Label Label Label Label Label Label Label Label";
l.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth;
l.backgroundColor = [UIColor clearColor];
[_footerView addSubview:l];
_footerView.backgroundColor = [UIColor lightGrayColor];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return _footerView.frame.size.height;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return _footerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
return [tableView dequeueReusableCellWithIdentifier:@"Cell"];
}
我要在定製表頁腳視圖標籤,在x = 60來繪製,但是當我運行該項目,在第一個標籤是無形的(縱向,屏幕附)。然後,如果我旋轉一次,它將變得可見,如果我旋轉回肖像它是可見的。
我錯過了什麼?
謝謝,這工作。 –