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 08-28-2010, 03:38 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Location: Shreveport, LA
Posts: 1
Rocking Roll is on a distinguished road
Default Custom backBarButtonItem

I have spent the better part of few hours a day for a week trying to implement a custom backBarButtonItem. Just curious if anyone has a solution for doing this. My designer choose a great tint color for the UINavigationBar and even some cool buttons to go along with it, and I haven't figured out how to use them. Using the standard buttons (normal/edit/save/done/etc) can leave it with some horrible color choices based on tintColor.

I am not looking at making a custom button and setting it as the leftBarButtonItem, then hiding the backBarButtonItem. This doesn't provide the animation of the back button sliding and changing alpha, and I feel is a bit hackish. Here is what I have tried so far.

1) While you can create custom backBarButtonItem with UIBarButtonItem, it disregards the customView that you can set on it.

2) Overriding the addSubview: and insertSubview:atIndex: methods on UINavigationBar will let you see that subviews of (private) class UINavigationItemButtonView are being added. Searching Google will get you some header information, it's a UIView subclass. You can add subviews, or sublayers to it all you want but you do not get any notification of it being pressed to show your pressed images. This is probably handled by the UINavigationBar as it a UIResponder subclass. In fact you can even hide the subviews then click on the UINavigationBar itself and it will respond accordingly.

3) There is a probably private method you can override on the UINavigationBar.
PHP Code:
-(void)drawBackButtonBackgroundInRect:(CGRect)rect withStyle:(int)style pressed:(BOOL)pressed
Works great and is exactly what I need, but I'm afraid of being rejected by Apple for using it, or worse slipped by then rejected later.

If anyone has any suggestions it would be greatly appreciated.
Rocking Roll is offline   Reply With Quote
Reply

Bookmarks

Tags
backbarbuttonitem, uinavigationbar, 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: 341
7 members and 334 guests
dre, freewind, hain, HemiMG, lendo, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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