最近项目遇到一个很奇葩的问题
点击按钮启动 presentViewController 的时候出现下图效果:
![](https://www.codeprj.com/image/aHR0cDovL2ltZy5ibG9nLmNzZG4ubmV0LzIwMTQwMzE5MTcwMzE1NjU2.png)
代码:
- AddFriendViewController *addFriendVC = [[AddFriendViewController alloc] init];
- UINavigationController *nav =[[UINavigationController alloc] initWithRootViewController:addFriendVC];
- [self presentViewController:nav animated:YES completion:nil];
- [addFriendVC release];
- [nav release];
后来才发现问题所在 UINavigationController 的背景颜色是黑色的;
为了解决TableView点击搜索出现的黑条:
代码:
- AddFriendViewController *addFriendVC = [[AddFriendViewController alloc] init];
- UINavigationController *nav =[[UINavigationController alloc] initWithRootViewController:addFriendVC];
- [nav.view setBackgroundColor:UIColorFromRGB(0xC6C6CB)];
- [self presentViewController:nav animated:YES completion:nil];
- [addFriendVC release];
- [nav release];
改变了Nav的背景色:
[nav.view setBackgroundColor:UIColorFromRGB(0xC6C6CB)];
效果:
![](https://www.codeprj.com/image/aHR0cDovL2ltZy5ibG9nLmNzZG4ubmV0LzIwMTQwMzE5MTcwMzUyNTQ2.png)