i am new in iphone coding and very frustrated. I can't figure out how to manage a tab bar controller including a navigation controller including a tableviewcontroller. Would it be possible, if someone figured it out, to write down the source here or better to pm me a xcode project!
2 or more tabs
in one tab the nav controller and the tabelviewcontroller
thx
PS.: Sorry for my english i am not a native speaker!
This is probably simple, but whats the syntax to change the nav bar color to black or trans? Ive tried a few things, but nothing seems to work. Do you know? Thanks.
i am new in iphone coding and very frustrated. I can't figure out how to manage a tab bar controller including a navigation controller including a tableviewcontroller. Would it be possible, if someone figured it out, to write down the source here or better to pm me a xcode project!
2 or more tabs
in one tab the nav controller and the tabelviewcontroller
thx
PS.: Sorry for my english i am not a native speaker!
Hey macstar.
The source-code in this thread should help you with setting this up and running.
All you need to do is create a tableViewController, and add that on as one of your viewControllers. (a tableViewController is a subclass of a viewController, so it will do everything the same if you want it to)
so you need any more help than that
?
if you need further help, I can write some code up on here, but this app is your own. I'm not going to write your app for you. So I'll give major pointers, but its you that needs to learn the basics of how to tie things together.
i would be very grateful if you can write some code down. I know i have to learn it by my self and i tried it, but examination of working code will help me at the moment a lot.
i would be very grateful if you can write some code down. I know i have to learn it by my self and i tried it, but examination of working code will help me at the moment a lot.
macstar
Me and my friend are new to this too.....the sample code has really helped us out. Dev has definately pointed us in the right direction on some things and its been a big help, but sample code, guides and tutorials are really the way to start out to learn on your own.
Yes, Dev has been a very helpful non-existent smilie-face and now we should all pay homage. GROUP HUG!
A huge hug for you
As the post title says, great thread DevTeamOfOne, it has been of great help for me... thanks to it I've been able to do in a couple of days more than I acheived struggling with IB over the lasts weeks.
Following your model I've been able to create my tabBar/NavBarController/tableView interface programatically and it's super-easy.
I'd like to ask you for a little guidance which I'm sure will help others as well.
I don't know if this is the right way of doing things but here it goes:
I'm creating a class from UIViewController for each of my table views inside the navigation controllers. As I said, I'm creating everything programatically instead of using IB as it seems easier (everything except the window which I haven't managed to get right, only a black window appears).
By now, I'm using the "-(id)initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil" method on my class just to set its title (self.title = @"My Title" so it shows in the NavBar from the beggining instead that after the view is loaded; also, on the loadView method I'm creating an UITableView and assigning it as the view for my Class. Finally, on the dealloc method of my class I'm releasing its tableView.
I'm implementing the UITableViewDataSource and UITableViewDelegate protocols so I also defined the numberOfRowsInSection and methods; by now, I just want to display static data.
What I described before I'm doing it the following way:
However... my table is just showing blank, I don't know really what I'm missing so any help to get this table to show (by now) just a couple of cells with static data would be greatly appreciated.
I was just looking back at this code (which has been INDISPENSABLE to me), and a question popped into my head: why don't you release the UITabBarController? no autorelease? no release in the dealloc method? I'm confused.
Wow, thanks for your answer. I knew I was missing my tableView dataSource declaration, which I didn't know that could be declared as 'self'. Now I'm all set to go.
I think I've finally gotten the hang of working with these things, and I found that putting easy to read NSLog commands at the beginnings of all of the viewDidLoad, viewWillAppear, etc. methods made it much easier to understand what was going on. You have to be careful to put your code in the right places, otherwise the views can't access the data. Just thought I'd put my two cents in. Thanks for all the help.
It can easily be done in IB, but learning the coding way to do it opens up far more possibilities
But learning the coding way correctly takes far more effort, and has a huge risk of leading to a bad design. Using IB kinda forces you onto the correct path Apple intended.
If you looked at my app you would find that mine has a rather great UI design. not much work either. Yes, it could, possibly, compromise design, but your goal as a developer is not to stick with Apple's guidelines to the letter. Its to bend them, and create a great UI in the process.
As for far more effort?
That kinda pays back in the "far more possibilites" area
There are 2 reasons why people are confused with tab applications:
Firstly the first view. This is the view that appears with the diagnoal lines on it. Click it and press delete. Now it looks normal and you know you need to now type in a nib name and set the class for that view. Then the view updates to "view loaded from FirstView.xib". I think that one tab view in the mainwindow nib and the other in another nib is confusing people.
Second is people don't know how to put Navigation controllers/table controllers inside the tab view so they can set other options in the inspector. It is in fact sooo easy to put a navigationcontroller inside a tab item view, its just a bit unobvious. Click the status bar of the tab bar controller icon in IB. Yes I said the status bar. Now you see something new in the inspector and you can set if you want the view to be a Navigation Controller or whatever. And now you can set other options on it including the initial title by double clicking the title.