Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 1, 2008, 12:15 AM   #1
ari.ehrmann
macrumors newbie
 
Join Date: Jul 2008
iPhone SDK help: UITabBarController

I've been having a problem with the iPhone SDK, specifically with the UITabBarController class. Whenever I try to implement a simple two-item TabBarController programmatically, it won't work.

I've found, through some simple debugging, that whenever I assign an array of view controllers to the TabBarController's viewControllers property, the array is actually assigned to the customizableViewControllers property. I cannot, for the life of me, figure out why this is.

I realize that I could just use interface builder, but I prefer to do it programmatically. If anyone has the answer to this question, I will be eternally grateful.

Thanks

Last edited by ari.ehrmann; Jul 3, 2008 at 02:15 PM. Reason: Misused Language
ari.ehrmann is offline   0 Reply With Quote
Old Jul 7, 2008, 06:35 PM   #2
dredmuns
macrumors newbie
 
Join Date: Jul 2008
UITabBarController

I had the same problem - programmatically creating a UITabBarController did not work the way the Apple documentation described. I found the answer on the Apple developer forum (http://discussions.apple.com/message...sageID=7444873).

Instead of doing:

Code:
tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
do just:

Code:
tabBarController = [[UITabBarController alloc] init];
Hope this helps.
dredmuns is offline   0 Reply With Quote
Old Jul 8, 2008, 12:10 AM   #3
ari.ehrmann
Thread Starter
macrumors newbie
 
Join Date: Jul 2008
Thanks

Thank you so much, dredmuns. I feel really dumb, but I just didn't think of doing that. I hope that documentation gets fixed. It was really aggravating getting errors doing exactly what Apple said to do. But I really appreciate the help. Thanks for responding.
ari.ehrmann is offline   0 Reply With Quote
Old Jul 13, 2008, 08:29 AM   #4
louden
macrumors 65816
 
louden's Avatar
 
Join Date: Dec 2003
Location: Seattle
In general, Apple preaches the best practice is to leverage Interface Builder as much as possible (and I agree with that). Unfortunately, Interface Builder wasn't really ready when they built most of their samples... So many of the samples don't use Interface Builder consistently.

I'll predict that getting over that stumbling block (of which I stumbled) will also cause quite a bit of frustration to new iPhone Developers. This post is a perfect example! (Loading a View with a Nib or not)
__________________

Dell Pentium 2 with 500 MB HD Windows 95
Compaq iPaq w/ 64MB of Ram
louden is offline   0 Reply With Quote
Old Jul 14, 2008, 07:27 PM   #5
Hazmit
macrumors newbie
 
Join Date: Jul 2008
Interface Builder is not better

Are there any fully programmatic or interface builder examples of a tab bar controller implementation. I'd love to see one as a reference that actually works with buttons on each view that link back to something.

I'm afraid I've tried to do things the interface builder way and I get stuck right when I think I've got it.

I can do all of the appropriate view rendering and switching of views but when I try to link IBOutlets or IBActions back to a controller my test app crashes trying to call the super class.
Hazmit is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: UITabBarController show only 1 tab igorladessa iPhone/iPad Programming 1 Dec 19, 2012 06:52 AM
X11 sdk joepistritto Mac Programming 4 Dec 4, 2012 05:10 AM
[Resolved]. Switching from UITableViewController, to new UITabBarController StigProgram iPhone/iPad Programming 4 Nov 16, 2012 03:58 PM
Resolved: how to access child controllers of a UITabBarController? Tex-Twil iPhone/iPad Programming 7 Jul 30, 2012 09:18 AM
Auto Layout in iOS6 SDK for larger screened iPhone Technarchy iOS 6 11 Jun 20, 2012 01:53 PM

Forum Jump

All times are GMT -5. The time now is 09:02 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC