在状态栏和导航栏之间添加图像

时间:2014-02-26 11:17:15

标签: ios iphone objective-c uinavigationbar statusbar

我正在尝试在IOS中的状态栏和导航栏之间添加图像。这可能吗?能否指导我如何实现这一目标?

基本上我正在努力实现这样的目标: enter image description here

2 个答案:

答案 0 :(得分:0)

我完全不知道,是否有可能?但我有一个像这样的想法, 您需要创建自定义navigationBar才能执行此操作,您需要在创建rootView控制器时隐藏它的navigationBar EX -

self.rootNavigationController.navigationBarHidden = YES;

然后在第一个顶部添加UIImageView自定义图片及其特定尺寸,然后添加自定义UINavigationBar (它是UIImageView/UIView或其他)带2个按钮。

答案 1 :(得分:0)

您可以使用UIImageView设置其图像,如下所示

- (void) viewDidLoad {

     topImage = [[UIIImageView alloc] initWithFrame:CGRctZero];
     topImage.image = [UIImage imageNamed:@"topim"];
     [self.view addSubview:topImage];

     // Add your UINavigationController here (or in Interface builder)
}

- (void) viewWillLayoutSubviews {

     topImage.frame = CGRectMake(0, 0, 320, 20);
     navController.view.frame = CGRectMake(0, 20, 320, self.view.bounds.size.height - 20);

}