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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 02-16-2009, 06:20 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 41
Default Custom back button in Navigation Controller views

I'm adapting Apple's DrillDownSave sample code, which let's you transition between views using a Navigation Controller.

What I want to do is have the first two screens NOT have the top bar. I can do that by putting this in the first two views 'viewWillAppear' method:
Code:
    // turn off the navigationBar (top bar)
    [[self navigationController] setNavigationBarHidden:YES animated:NO];
Great... no top bar. But now I am struggling to implement a button (UIButton) which will perform exactly the same function as the hidden UINavigationController back button. Any ideas?
TimC is offline   Reply With Quote
Old 02-16-2009, 08:31 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 495
Default

Add a UIButton to your interface, in the action for that call popViewControllerAnimated: on the navigationController. If you're inside a view controller, you can use [self.navigationController popViewControllerAnimated:YES];
__________________
My Apps on AppStore : gScale (guitar scales reference), eMaze, eMaze Lite, eTimesheet
exorcyze is offline   Reply With Quote
Old 02-16-2009, 01:59 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 41
Default

Quote:
Originally Posted by exorcyze View Post
Add a UIButton to your interface, in the action for that call popViewControllerAnimated: on the navigationController. If you're inside a view controller, you can use [self.navigationController popViewControllerAnimated:YES];
Thanks, that did it.
TimC is offline   Reply With Quote
Old 03-12-2009, 01:57 AM   #4 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 7
Default

Quote:
Originally Posted by TimC View Post
Thanks, that did it.
That was just what the doctor ordered.

Only one problem ...

I want my "fake" back button to look like the real back button used by the UINavigationController.

Does anyone know how to do this?

Any ideas .... ?
mdwturner is offline   Reply With Quote
Old 03-12-2009, 06:56 AM   #5 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 429
Default

make screenshot of real button (both inactive and active) and then use that as the image for the two states of your button.

please use the search function, this question has been asked a gazillion times.
lbendlin is offline   Reply With Quote
Old 03-12-2009, 01:59 PM   #6 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 7
Default

Quote:
Originally Posted by lbendlin View Post
make screenshot of real button (both inactive and active) and then use that as the image for the two states of your button.

please use the search function, this question has been asked a gazillion times.
Thanks so much!

I actually did search the web for several hours, and only found this particular thread. Also, I've just used the search utility for this board, and could not find any related posts. At the risk of a thrashing ;-) can you suggest what terms would return related articles? I'd like to read any related posts ... and I guess my brain is not cooperating with search terms that will work (and it's not even Monday).
mdwturner is offline   Reply With Quote
Old 03-12-2009, 06:28 PM   #7 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 7
Default

Quote:
Originally Posted by mdwturner View Post
Thanks so much!

I actually did search the web for several hours, and only found this particular thread. Also, I've just used the search utility for this board, and could not find any related posts. At the risk of a thrashing ;-) can you suggest what terms would return related articles? I'd like to read any related posts ... and I guess my brain is not cooperating with search terms that will work (and it's not even Monday).

So after more searching, I still haven't found much.

I did however try the suggestion to take a screen snapshot of the "real" back button and use it's image. When I try this, the captured image displays as a blank. I know the code is okay because I can open any of the standard image files and they display properly. Just the ones I drop into the xcode folder display as blank. I've searched alot for a solution but no luck.

Any ideas?
mdwturner is offline   Reply With Quote
Old 09-28-2009, 06:11 AM   #8 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 2
Default

Hey,
I'm having the same problem.. did you manage to sort this out?

I take a screenshot of the back button, which is fine, but Apple applies the default effects to it (as for all UIButtonBarItem's), and this makes it look incorrect, appearing white.

Any help would be much appreciated,
Mike.
mikecrowe is offline   Reply With Quote
Reply

Bookmarks

Tags
backbutton, button, custom, uinavigationcontroller

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: 243
15 members and 228 guests
ADY, AragornSG, Dani77, Dattee, Duncan C, fkmtc, HDshot, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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