如何从自定义导航栏移动到半透明导航栏并返回?显示问题!
所以,我得到了这个基于导航的应用程序(带有自定义导航栏 - 类别),并且我在这里遇到了 2 问题...
@implementation UINavigationBar (Custom)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"bg_toolbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
由于基于导航的应用程序,大多数视图都有一个 高度 436px(= ScreenSize - 导航栏高度,您可能知道;)。
我得到了一个类似于照片应用程序概述的视图,显示了所有缩略图,从那里我将一个包含滚动视图(如照片应用程序中的视图)的视图控制器推送到堆栈上,就像
- (void)buttonPressed:(id)sender
{
UIButton *btn = (UIButton *)sender;
PhotoSetScrollViewController *psc = [[PhotoSetScrollViewController alloc] initWithPhotoArray:photos andID:btn.tag];
[self.navigationController pushViewController:psc animated:YES];
}
问题1一样: 持有全屏滚动视图的视图的高度为480px,这似乎是一个问题,因为当通过点击后退按钮弹出视图控制器时,包含缩略图的视图(高度< strong>436px)在导航栏下方向上移动。而且工具栏也不断显示。可能是什么问题?
编辑:当导航和工具栏显示(最初隐藏)时,全屏滚动视图也会移动。即使没有自定义导航栏,我也能看到浮动的视图。这很奇怪。
问题2: 如何在自定义导航栏和标准黑色半透明样式之间切换?
So, i got this Navigation-based App (with a custom NavigationBar - Category) and I have 2 problems here...
@implementation UINavigationBar (Custom)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"bg_toolbar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end
Because of the Navigation-based App, most of the views have a height of 436px (= ScreenSize - NavigationBar height, as you probably know ;).
I got one view similar to the photo app overview showing all the thumbnails, from there I push a viewcontroller containing the scroll view (like in photos app) on the stack, like so
- (void)buttonPressed:(id)sender
{
UIButton *btn = (UIButton *)sender;
PhotoSetScrollViewController *psc = [[PhotoSetScrollViewController alloc] initWithPhotoArray:photos andID:btn.tag];
[self.navigationController pushViewController:psc animated:YES];
}
Problem 1:
The view holding the fullscreen scrollview has a height of 480px which seems to be a problem because when poping the viewcontroller by hitting the back button, the view containing the thumbnails (height 436px) moves upward below the navigation bar. And also the Toolbar keeps showing. What could be the problem?
EDIT: The fullscreen scrollview is also moving when the navigation and toolbar are shown (hidden initially). And even without the custom navigationbar i get the views floating around. That is weird.
Problem 2:
How could I switch between my custom navigation bar and the standard black translucent style?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jd,
问题 1:请澄清您的问题...您是否试图使其与“照片”应用程序相同,在其中单击单张照片,然后可以隐藏导航栏和工具栏?除非您明确隐藏工具栏,否则当您通过点击后退按钮弹出视图时,它将继续显示。您可以延迟弹出视图并隐藏它,或者在先前视图控制器的 viewDidAppear 方法中隐藏它。
如果您的视图在移动,您可能需要检查 IB 中的框架设置(单击相关视图后检查器窗口中最后一个选项卡的第二个选项卡)。另外,请确保将伪造的导航栏放入 XIB 文件中,以便可以正确布置所有内容。
问题 2:
首先,检查这篇文章:使用图像或色调颜色在 iPhone 中的 uinavigationbar 上?
然后也使用这个:
jd,
Problem 1: Please clarify your question.... Are you trying to make it the same as the Photos app, where you click on a single photo and then you can hide the nav bar and the toolbar? Unless you explicitly hide the toolbar, it will continue to show when you pop your view by hitting the back button. You can delay the pop view and hide it or hide it within the
viewDidAppear
method of the prior view controller.If your view is moving around, you may want to check your frame settings in IB (2nd to the last tab in the inspector window after you click on the view in question). Also, make sure you put the faked in nav bar in your XIB files so you can lay everything out correctly.
Problem 2:
First, check this post: using image or tint color on uinavigationbar in iphone?
Then use this as well: