TableView覆盖状态栏

Since we’ve switched over to a plain table view, let’s fix the top edge offset, too, by adding some code to the viewDidLoad method.

if (tableView.style == UITableViewStylePlain) {

UIEdgeInsets contentInset = tableView.contentInset;

contentInset.top = 25;

[tableView setContentInset:contentInset];

}

下面的代码使文字在状态栏下半透明显示。

if (tableView.style == UITableViewStylePlain) {

UIEdgeInsets contentInset = tableView.contentInset;

contentInset.top = 25;

[tableView setContentInset:contentInset];

UIView *barBackground = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];

barBackground.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.9];

[self.view addSubview:barBackground];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容