MKMapview in tabbed application in xcode 4.2 - iphone

I am a beginner in iOS development and have just start using the lasted xcode 4.2. I am developing an application using the storyboard having a tabbed interface. The application will have four tabs among which one should incorporate a Mapview. After setting the four tabs and linking them all together, i added a mapview to my first tab but i cant edit the Mapview properties or even add annotations since when adding the Mapview, it does not come with any .h or .m file. Any help concerning this would be greatly helpful.

You need to create classes (.h/.m) for your UIViewController's and link the interface elements in the storyboard to the underlying classes. Then within your UIViewController implementations, you can link your interface MKMapView to your class properties, then you can manipulate the MKMapView instance any way you want programatically through your UIViewController implementing class.
See here for a tutorial on usage of the storyboard.

Related

Object library changes using XCode 4 and storyboard

When working in the .h or .m of my iPhone app in XCode, the Object Library contains a lot of nice buttons and stuff, i.e. a checkbox, which I would like to add to the interface. But when I enter the storyboard, it changes to just "Objects" and many of the buttons are replaced with view controllers and other stuff. How can I find the Object Library with all the buttons in my storyboard? I wanna add some checkboxes etc in my app. Thanks.
See when you are working in .h and .m the object library shows all the stuff of iPhone/iPad and Mac.but when you open storyboard for iPhone/iPad all the stuff regarding Mac development is gone ,only the stuff relevant to iPhone/iPad is shown.

MGSplitViewController using Storyboards

I have been working on this for some time now and just cant quite get it to work... Has anyone implemented a MGSplitViewController app using storyboards in iOS 5? I just cant get anything to show up like in the example project and was wondering if there were any tutorials or just steps to getting this to work...
Thanks
iOS 5 allows you to custom create View Controller containers.
Refer to "Implementing UIViewController Containment". They have a sample project demo, but not sure if they have published the source code.
I think you can create a root ViewController that holds two more child ViewControllers
Child 1 - Has UITableView and is aligned left.
Child 2 - Has UIView for the details on the right.
MGSplitViewController style transition could be achieved through transitionFromViewController:toViewController:

How-to incorporate a UISegmentedControl inside a UITabBarController?

I used the following tutorial Red Artisan to create a UISegmentedControl which I use to switch between two views: a simple one and a table view.
Everything is fine when I create a new standalone project, but what I really want is to incorporate this functionality in another project with a UITabBarController as the rootController (the segmented control with two views will be inside the second tab).
In the above tutorial the segmented control, navigation and segment controllers are instantiated and configured from within the application delegate.
Any idea how this could be done from a lower level?
Thank you in advance!
Basically, you need to create a UITTabBarController based application (There are LOTs of tutorials on how to do this), and then in the second UIViewController (or a custom subclass), you would create your UISegmentedControl to switch between two pages.
It sounds like you might also be using a UINavigationController as your base controller in the first application, if this is so..you could have a UITabBarController that has two Controllers in it (two tabs), and the second one will be a UINavigationController like how you had it setup in the app delegate.
Also, there are tutorials to do basically this exact thing all over the internet. Try searching for " UINavigationController inside UITabBarController " or similar. One other thing, there is an example of how the "layering" works in the Apple UI documentation for having a UINavigationController be one of the tabs of a UITabBarController (This is a quite common approach for iPhone apps)
Good luck!

Connecting outlets in Window Based App, Objective-C

I'm reading through a beginners iPhone text book and just finished writing all the code for a route tracker app that uses Map Kit and Core Location. I have the app running with no errors on my iphone 4 device but when I tried interacting I realized that none of my IBOutlets were connected to anything. When I referenced the beginning of the tutorial in the text, all it says is to "connect the appropriate outlets".
Here's why this usually simple task has me confused. The tutorial says to create a Window Based Project, so there is no ViewController. Then, in Interface Builder, the view is built in MainWindow.xib. The only IBOutlets of the project are located in Controller.h / Controller.m files that you create and which contain mostly all of the code for the app.
I usually ctrl-drag from File's Owner to the UI in Interface Builder, but in this project there seems to be no way for me to access the IBOutlets in Controller.h / .m from the MainWindow.xib file.
I'm frustrated because it seems like this should be such an easy fix but I'm totally stumped.. any help is really appreciated. Thanks
As I see it, you have two choices:
Add the outlets to the app delegate. This is probably not the best plan.
Put an instance of your controller class in the .xib file.
I think option 2 is what you want. If you check the Controllers section of the library, you'll see a component called "Object". Drag one of those into your xib, then inspect it. Select the info pane in the inspector (the circle with a white i in it) and change the Class to the name of your controller class.

Moving tableview into existing window in Interface Builder

In Interface Builder, I dragged a UITableViewController object from the library into the project. Then, a tableview popped up. How do I get that tableview inside my already existing window?
Thanks, I'm totally lost!
That tableview is part of the UITableViewController, and is connected to its view property. The second window pops up so you can set that UITableView's properties directly.
If you're just starting out, I'd suggest checking out a few tutorial. The site I started learning from is called http://icodeblog.com/, and I'd also recommend the Beginning iPhone Development book by Jeff LaMarche and Dave Mark. Also, if you have iTunes, the Stanford iTunes class is a terrific way to learn in-depth about iPhone development, and it is free to download from iTunesU.
If you have created a view based application, the thing that you need is to add a uitableview from the library to the view. Be sure that you add uitableview, not its controller. It will be seen under dataviews
You have to take UIViewController first and bind it with view. Then add UITableView in your controller and bind it with IBOutlet object of UITableView.
Then you have to set datasource and delegate of UITableView. That's all. Now you can access all the methods of UITableVIew inside your controller.
If you still find any problem then please let me know. I will definitely help you out to solve this problem.