Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-23-2010, 05:09 PM   #1 (permalink)
Registered Member
 
mouser58907's Avatar
 
Join Date: Feb 2010
Posts: 188
mouser58907 is on a distinguished road
Default UIBarButtonItem Action not working

Here is my code, why in the world will this not call HideNavController?!?

HomePageController.h
Code:
-(void)HideNavBar:(id)sender;
HomePageController.m
Code:
- VIEW DID LOAD {
...
	UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(HideNavBar:)];
	temporaryBarButtonItem.title = @"Back";
	self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
	//[temporaryBarButtonItem release];
}

-(void)HideNavBar:(id)sender{
	[[self navigationController] setNavigationBarHidden:YES];
}
It compiles fine, but never calls HideNavBar!!!
__________________
My Apps:Pee Prank (free)
My Company: Pulsar Productions

If I helped you, download my App or tell a friend! Thanks.
mouser58907 is offline   Reply With Quote
Old 10-25-2010, 01:27 PM   #2 (permalink)
Registered Member
 
mouser58907's Avatar
 
Join Date: Feb 2010
Posts: 188
mouser58907 is on a distinguished road
Default

__________________
My Apps:Pee Prank (free)
My Company: Pulsar Productions

If I helped you, download my App or tell a friend! Thanks.
mouser58907 is offline   Reply With Quote
Old 10-25-2010, 01:43 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 327
thomashw is on a distinguished road
Default

How do you know it doesn't call the method? Have you tried throwing an NSLog in there, or setting a breakpoint?
thomashw is offline   Reply With Quote
Old 10-25-2010, 02:25 PM   #4 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default

Quote:
Originally Posted by mouser58907 View Post
Here is my code, why in the world will this not call HideNavController?!?

HomePageController.h
Code:
-(void)HideNavBar:(id)sender;
HomePageController.m
Code:
- VIEW DID LOAD {
...
	UIBarButtonItem *temporaryBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(HideNavBar:)];
	temporaryBarButtonItem.title = @"Back";
	self.navigationItem.backBarButtonItem = temporaryBarButtonItem;
	//[temporaryBarButtonItem release];
}

-(void)HideNavBar:(id)sender{
	[[self navigationController] setNavigationBarHidden:YES];
}
It compiles fine, but never calls HideNavBar!!!
Try:
Code:
[NavigationBar setHidden:YES];
aldcorn@live.com is offline   Reply With Quote
Old 10-25-2010, 06:08 PM   #5 (permalink)
Registered Member
 
mouser58907's Avatar
 
Join Date: Feb 2010
Posts: 188
mouser58907 is on a distinguished road
Default

Quote:
Originally Posted by thomashw View Post
How do you know it doesn't call the method? Have you tried throwing an NSLog in there, or setting a breakpoint?
Yeah, I've been trying breakpoints. Also, aldcorn, I used setNavigationBarHidden: YES earlier in the code to hide it initially and it worked fine. Thanks for the responses.
__________________
My Apps:Pee Prank (free)
My Company: Pulsar Productions

If I helped you, download my App or tell a friend! Thanks.
mouser58907 is offline   Reply With Quote
Old 10-25-2010, 09:07 PM   #6 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default How are you calling it?

Hi,
What user action is supposed to fire the action? Button press?

This is not clear to me. If you are just trying to hide the navbar you can just do that in the viewWillAppear?

[setNavigationBarHidden: YES];

Quote:
Originally Posted by mouser58907 View Post
Yeah, I've been trying breakpoints. Also, aldcorn, I used setNavigationBarHidden: YES earlier in the code to hide it initially and it worked fine. Thanks for the responses.
aldcorn@live.com is offline   Reply With Quote
Old 10-25-2010, 10:07 PM   #7 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default

My last try and then I will leave it to the experts

Code:
navController.navigationBarHidden = YES;
Quote:
Originally Posted by mouser58907 View Post
Yeah, I've been trying breakpoints. Also, aldcorn, I used setNavigationBarHidden: YES earlier in the code to hide it initially and it worked fine. Thanks for the responses.
aldcorn@live.com is offline   Reply With Quote
Old 10-25-2010, 11:58 PM   #8 (permalink)
Registered Member
 
mouser58907's Avatar
 
Join Date: Feb 2010
Posts: 188
mouser58907 is on a distinguished road
Default

aldcorn, thank you so much. I totally blanked on using viewWillAppear. Not sure why it didn't work before, but using viewWillAppear works marvelously!
__________________
My Apps:Pee Prank (free)
My Company: Pulsar Productions

If I helped you, download my App or tell a friend! Thanks.
mouser58907 is offline   Reply With Quote
Old 10-26-2010, 12:00 AM   #9 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 551
aldcorn@live.com is on a distinguished road
Default yeah!

Glad I could help!

Take care,
Rob
aldcorn@live.com is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 324
12 members and 312 guests
chiataytuday, condor304, Desert Diva, Domele, dre, dreamdash3, mottdog, oceanlablight, palme2elie, Paul Slocum, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,659
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dreamdash3
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:15 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0