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

View Single Post
Old 02-11-2011, 03:52 PM   #13 (permalink)
roocell
Registered Member
 
Join Date: Feb 2009
Posts: 97
roocell is on a distinguished road
Default

Quote:
Originally Posted by jazztpt View Post
Even simpler: UIButton is a subclass of UIView. Create your button, add your action and target, and use that button as the custom view.

You can also do this in Interface Builder -- drag a button onto the main object window (not a subview to any of your views), drag the Touch UpInside event to the appropriate selector in your File's Owner, and then in viewDidLoad:

self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:myButton] autorelease];
Thanks so much. I've been doing this for a while now and this is the first time I've come across the method to use IB to create an object, but not put it in any views. This is *way* easier than doing things programmatically!

I've used IB a lot, but always for things in my views. Other things like UIActivityIndicators I've created programtically, which is a PITA. This method is a snap!
roocell is offline   Reply With Quote
 

» Advertisements
» Online Users: 398
10 members and 388 guests
7twenty7, antonwilliams, Arty Tales, DaveDee, erdinc27, eski, Lily.P, networ, roof44, ryantcb
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,594
Threads: 94,084
Posts: 402,779
Top Poster: BrianSlick (7,990)
Welcome to our newest member, kopmlop
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:06 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.