Quote:
Originally Posted by jazztpt
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!