我正在制作一个应用程序,并被要求在导航栏上放置一个 Logo ,但也超出了栏的边界,覆盖了我的部分 View 。这正是它应该放置的方式(白色圆圈是 Logo )。
由于此应用中的 View Controller 结构复杂,我想使用 UINavigationController,但它似乎会使 Logo 的放置有点问题。
执行此操作的好方法是什么? (由于奇怪的放置,显然将 Logo 作为导航栏的标题图像是不可能的)
我正在考虑将其作为 keyWindow 或 navigationController.view 的 subview 。第一个是否会导致我的应用被 Apple 拒绝?
最佳答案
如果你想从 UIViewController
添加图像而不是 UINavigationController
的子类,你可以这样做:
-(void)addImageOnTopOfTheNavigationBar {
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage"]];
imageView.frame = CGRectMake(....); //set the proper frame here
[self.navigationController.view addSubview:imageView];
}
关于ios - 如何在导航 Controller 导航栏顶部添加图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20003394/