开发者

How to move from custom to transluscent NavigationBar and back? Display problems!

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 *)send开发者_如何转开发er;
    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?


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:

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜