Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Help adding .H and .M files to a view controller

Im just starting to use xcode and actually just starting to learn ANY programing language so basicly ive created a hello world application then i wanted to take this a step further by creating a tab based application and doing little things to help myself learn the basics. So you have the 2 original view controllers with a tab bassed application, well i added 2 more view controllers and connected them to the tab bar controller (by the way took me forever to figure that out) now what i want to do is create the .h and .m files for the 2 more view controllers, how can i do this?? Oh and by the way im on the latest xcode version.

Posted on Sep 21, 2013 11:29 AM

Reply
Question marked as Best reply

Posted on Sep 21, 2013 5:51 PM

These detailed steps are for Xcode 4.6.3 but should be very similar in Xcode 5.


1. Add a view controller to the storyboard of the desired type (ex: View Controller). [Drag from the Object Library.] I think you have already done this.


2. Create a class module for the view controller. [File > New > File... > User Interface > iOS > Cocoa Touch > Objective-C Class.] Specify an appropriate class name (ex: FirstTabDetailsViewController), subclass from the same type used in step 1 (ex: UIViewController). Do not check XIB.


3. Select the new view controller in the storyboard. Be sure the view controller is selected, not the view. Easiest way is to select in the Document Outline, not the design surface. In the Identity Inspector > Custom Class > Class, select the class name of the class you just created.

User uploaded file


4. Build to confirm everything is hooked up correctly.


5. When you show the assistant editor for the storyboard, the new .h should appear.

2 replies
Question marked as Best reply

Sep 21, 2013 5:51 PM in response to ltaa09

These detailed steps are for Xcode 4.6.3 but should be very similar in Xcode 5.


1. Add a view controller to the storyboard of the desired type (ex: View Controller). [Drag from the Object Library.] I think you have already done this.


2. Create a class module for the view controller. [File > New > File... > User Interface > iOS > Cocoa Touch > Objective-C Class.] Specify an appropriate class name (ex: FirstTabDetailsViewController), subclass from the same type used in step 1 (ex: UIViewController). Do not check XIB.


3. Select the new view controller in the storyboard. Be sure the view controller is selected, not the view. Easiest way is to select in the Document Outline, not the design surface. In the Identity Inspector > Custom Class > Class, select the class name of the class you just created.

User uploaded file


4. Build to confirm everything is hooked up correctly.


5. When you show the assistant editor for the storyboard, the new .h should appear.

Help adding .H and .M files to a view controller

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.