Tweet So today we will create our first view. This takes over where Create a new class left off. So you can grab the source code from there if you need to. I also edited the arrows for the rows by following this tutorial I created.
Also in the DataController.m class I am changing the names to something more meaningful.
[menuArray addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"Browse", @""), @"title", nil, nil]]; [menuArray addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"
Tweet So now that we have a working navigation based application. (download source here) We now want to move the data outside to a seperate class. We do this so we can use the data around the application and not just RootViewController class.
Do you get why? Its so we can use the data in the next view we will get into later.
So the first thing you want to do is create a data holder class.
Tweet I found a something a bit late what would of been nice to cover before. I guess it is better late then never right?
In offical IPhone apps there are arrows on each row you can click on that mean you can click here to users. We want to add these nice little arrows.
So open up RootViewController.m and look for the function cellForRowAtIndexPath and in the if (cell == nil) {} block you want to add a link for accessoryType so it looks like
Tweet I am assuming that you have the Iphone SDK installed. If you need help with getting that installed or do not know what a SDK is then this blog will probably be over your head.
So first thing is to start Xcode. I have mind in the menu bar (sorry I am not a Mac person so I have no clue what it is called )
Once Xcode is started you will be greated with the opening screen that looks like this.
Tweet So now that you have gotten your hands a bit dirty in the code, lets learn about Interface Builder. If you noticed when you launched your application, there was a blue/white gradient that was blank. So lets do a quick tutorial on how to populate that in Interface Builder.
So in the files section in xcode you will see a MainWindow.xib. If you double click that it will launch Interface Builder.
Tweet So like every good tutorial we need to create a Hello World application. We will use what we have learned in the past tutorials and build on them.
So the first thing you want to do is open the file RootViewController.m
Look for the following code block
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } We want to make it return a 1 so make it look like the following
Tweet One of the things I like about the tab controller is the easy option to add a image into them. I do give it to apple on how their framework has everything thought out for a good user experience. As a programmer, I hardly have to think about the UI at all. I just have to make it work.
So you want to double click on the MainWindow.xib. This will launch Interface Builder.
Tweet So now that we have a hello world application that works, we want to add more items to the list. I would think most application will not have just one menu item. So here we go.
The easiest way to do this is create an array object that contains all of the menu items. I am not going to go into what everything is just the basic overview. If you want to learn I will point you to the documents on Apple’s website.
Tweet Now that you have a very basic app. If you click the menu button on the Iphone simulator, you will see the name of your app and above it is a nasty white box. If you want a nice little icon there you can just drag it to the application name root on the left side. For my examples that would be Photoblog. It will prompt you to import it and do so.
Tweet I will attempt to explain what the default files are. If I get these wrong please correct me.
So below is a screenshot of the default files that get placed in your project when you create a navigation based application.
CoreGraphics.framework / Foundation.framework / UIKit.framework – These files are created by Apple that contain all the framework code we will be using to create the applications. You will never have to touch these but they should always be in your application.