我创建了一个应用程序,在第一页中我添加了UINavigationController,但是我有一个问题。 它是导航栏中的底部边框....
我想删除此边框底部或清除边框的颜色。 请帮我
答案 0 :(得分:2)
要从UINavigationBar
移除底部边框,您可以在app delegate中使用以下方法:
- (void) removeBottomBarFromNav:(UINavigationBar *) navBar {
for (id subView in [navBar subviews]) {
for (id subViewInner in [subView subviews])
{
if ([NSStringFromClass([subView class]) isEqualToString:@"_UINavigationBarBackground"])
{
if ([subViewInner isKindOfClass:[UIImageView class]]) {
[subViewInner removeFromSuperview];
break;
}
}
}
}
}
您可以使用此方法,如下所述:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
home * ObjLoginPage = [[home alloc] initWithNibName:@"home" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:ObjLoginPage];
[self removeBottomBarFromNav:self.navigationController.navigationBar];
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}