作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想制作一个自定义导航栏,就像在 BestBuy 应用程序中一样,或者像下面给定的屏幕截图所示。
我希望这种类型的导航始终位于每个 viewController 的顶部。
如果有人能告诉我程序或任何类型的帮助,我们将不胜感激。谢谢。
最佳答案
编写 UINavigationBar 的子类,您可以在其中自定义绘图并根据需要添加 subview 。
然后通过使用 initWithNavigationBarClass:toolBarClass:
例如
@interface MyBar : UINavigationBar
@end
@implementation MyBar
.... //like any UIView
@end
UINavigationController *navi = [[UINavigationController alloc] initWithNavigationBarClass:[MyBar class] toolbarClass:nil];
代替 initWithRootViewController
示例
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.mainViewController = [[FDMainViewController alloc] initWithNibName:@"FDMainViewController_iPhone" bundle:nil];
} else {
self.mainViewController = [[FDMainViewController alloc] initWithNibName:@"FDMainViewController_iPad" bundle:nil];
}
UINavigationController *navi = [[UINavigationController alloc] initWithNavigationBarClass:[UINavigationBar class] toolbarClass:nil];
navi.viewControllers = @[self.mainViewController];
self.window.rootViewController = navi;
[self.window makeKeyAndVisible];
return YES;
}
关于ios - 如何创建像 BestBuy App 这样的自定义导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14747665/
我想制作一个自定义导航栏,就像在 BestBuy 应用程序中一样,或者像下面给定的屏幕截图所示。 我希望这种类型的导航始终位于每个 viewController 的顶部。 如果有人能告诉我程序或任何类
我在 bestbuy.com 上发现了一个 IE8 错误,我似乎无法理解为什么会出现这种错误。它也在 IE8 中出现在 comcast.com 和 raymourflanigan.com 等网站上,但
我是一名优秀的程序员,十分优秀!