Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 12    Views: 149

MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
06/27/12 05:38 PM (13 years ago)

Custom Nav Bar in iOS problem

I've successfully implemented a custom navigation bar using dual images - one for portrait and one for landscape. The images work great, but I can't get them to automatically switch upon rotation. Only clicking certain tabs will trigger the change. Would love some help if anyone has any suggestions. I put a screencast up so you can see exactly the issue. http://www.youtube.com/watch?v=FNU1L1j2Rmo I've tried a zillion different combinations in BT_rotatingTabBarController.m, BT_rotatingNavController.m, BT_viewUtilities.m and BT_viewController.m but nothing is working. Would greatly appreciate any and all help to figure this out. Thanks.
 
MacApple
Apple Fan
Profile
Posts: 4675
Reg: Oct 25, 2010
USA
61,150
like
06/27/12 06:06 PM (13 years ago)
MGoblue Looks slick, subscribing and crossing fingers one of the ninjas jump in.
 
Black White
I hate code!
Profile
Posts: 292
Reg: Feb 22, 2012
hanoi
4,770
like
06/27/12 08:43 PM (13 years ago)
pls show your tutorial how can do that hehe
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/27/12 08:56 PM (13 years ago)
@Black White - Tutorials will be forthcoming. I have several cool features in this app including that nav bar. Once I get everything perfected I'll work up tutorials. Some of the features: ★ Socialize Integration - share/like/comment articles from rss feed and photos from flickr photo gallery. ★ Share quiz results to Facebook and Twitter. ★ Game Center integration ★ Custom Nav Bar ★ Custom Tab Bar with enlarged center tab plus a few more. Also, I've got an image emailer plugin working well.
 
Known
Apple Fan
Profile
Posts: 83
Reg: Jan 07, 2012
Suttons Bay, Mi...
830
like
06/27/12 10:11 PM (13 years ago)
Following..... :)
 
Fred@mySkylla com
Android Fan
Profile
Posts: 5259
Reg: Oct 03, 2011
location unknow...
62,560
like
06/27/12 10:53 PM (13 years ago)
Very interesting, following. Fred
 
Known
Apple Fan
Profile
Posts: 83
Reg: Jan 07, 2012
Suttons Bay, Mi...
830
like
06/27/12 11:51 PM (13 years ago)
Must have left my manners in the other room... the app is stunning. Truly shows what a UofM fan you are. No missing that! Kudos. Cheryl
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
06/28/12 02:18 AM (13 years ago)
Hi MGoBlue. I probably have a solution for you here. It works for me after 30 min laborate. I found some code now after a little googling. You may experiment with the size to get your image right. In BT_viewUtilities.m about line 270. you now that! :) if([theViewController.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) { //iOS 5 new UINavigationBar custom background [theViewController.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbarv1.png"] forBarMetrics: UIBarMetricsDefault]; //uncomment this line /* }else{ [theViewController.navigationController.navigationBar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbarv1.png"]] autorelease] atIndex:0]; } /* // Create resizable images UIImage *gradientImage44 = [[UIImage imageNamed:@"navbarv1.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, -180, 0, 0)]; UIImage *gradientImage32 = [[UIImage imageNamed:@"navbarv1.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, -180, 0, 0)]; // Set the background image for *all* UINavigationBars [[UINavigationBar appearance] setBackgroundImage:gradientImage44 forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setBackgroundImage:gradientImage32 forBarMetrics:UIBarMetricsLandscapePhone]; } Tell me if you get it to work. //Macki
 
ATRAIN53
Code is Art
Profile
Posts: 1755
Reg: Nov 17, 2011
Chicago
26,450
like
06/28/12 06:58 AM (13 years ago)
Looks really nice except for all that nasty Maze and Blue. LOL. Re-decorate it with some real Blue and Gold. GO IRISH!!!! or maybe make it over with some Purple Pride. GO CATS! 64 Days until kickoff! and a big Sunday night game this year MI/ND. can't wait. it's always a bittersweet ending to summer, the start of College Football! -- are those custom nav/tab bars just standard cocoa controls? i've been looking at a a few of them and tinkering a bit. some success with the tab bar. it's tricky to keep the BT Nav controllers in place. i've blown it up before in my plug-in testing. anxious to see how you managed navagation with a custom controller to BT screens. always look forward to any notes/tips/tutus you post. your guides and instructions are just excellent.
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
06/28/12 08:04 AM (13 years ago)
@ATRAIN53 - Looking forward to the game too. I have a Notre Dame app in the app store (actually a couple dozen schools) and they'll all get these updates once I get them worked out. @Mackimack - Thanks for the code. It's pretty similar to what I've been working with. I think my problem is the static size image. I'm using that to keep the logo centered. With your code suggestion I still get the same problem of needing to click on a tab to get the changed navbar to occur. I'll keep experimenting. @Cheryl - Thanks!
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
06/28/12 08:34 AM (13 years ago)
@MGoBlue I do not have a app with custom navbar with rotation. So I nade a test app to see if I culd find a solution. I got the same problem as you did when I change tabs, the image was shown several times. When I put in my code that worked on the image, only showed one image in navbar. I do not now of you use two image for the navbar a navbar.png and [email protected]? I referring only To navbar.png.
 
Mackimack
Apple Fan
Profile
Posts: 481
Reg: Dec 30, 2010
Sweden
14,310
like
06/28/12 08:41 AM (13 years ago)
Oh I forgot. If you made a 320px x 44px transparent png and put your logo in the center of the image. Then you do an same 640px x 88px. Do you not think it would work??
 
DryFrog
Lost but trying
Profile
Posts: 42
Reg: Jun 26, 2012
São Paulo
4,620
like
06/22/13 03:24 PM (12 years ago)
Hello, everyone Subscribing to this. I have a custom navbar that is being cut when changing orientation from portrait to landscape (this not happen when the application is in landscape from the previous screen, only when I change orientation). I've tried the code above proposed by Mackimack, but it didn't solved my problem... I'd be the most grateful if someone could help, Cheers! dryFrog
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.