Sorry if my question looks noob, im new in objective c programming. Im using 4.6 xcode, and when i started to make new built in tab project, then I started to add new UIViewController subclass file, i cant find it. If the template is changed, which template that can provide 3 file (.h, .m, .xib) same with UIViewController. Answer will be appreciate. thanks
Choose the Objective-C class template from the Cocoa Touch section. On the next page, select or type UIViewController in the "Subclass Of" field. Make sure "With XIB for user interface" is checked.
Related
I new how to do it in Xcode 5 but now it isn't as straight forward, at least for me. I used to choose Objective C Class when making a new one but in the 6 there is no C Class just a lot of different options.
Thanks in Advance,
James
Create either a Cocoa Touch Class (iOS) or Cocoa Class (OS X) file. Make the class a subclass of UIViewController or NSViewController.
So according to this tutorial
"Xcode uses the product name you entered to name your project and the app. Xcode uses the class prefix name to name the classes it creates for you. For example, Xcode automatically creates an app delegate class and names it HelloWorldAppDelegate. If you enter a different value for the class prefix, then the app delegate class is named"
However when I create my project, it doesn't create the files with my project name. So instead of "ProjectNameAppDelegate.h" I just have "AppDelegate.h". Is there a reason why XCode wouldn't create the proper files I need and how do I fix it?
I also don't have a ViewController.xib file which most online tutorials say I should have. I do have a "MainStoryboard.storyboard but I'm not sure if that counts as the same thing.
The tutorial you mentioned is on an old Xcode. The latest Xcode wont create appDelegate and ViewController classes by prefixing project name as you said like ProjectNameAppDelegate.h. It simply create AppDelegate.h only. It is not a bug.
In the above figure you can see that i have selected Use StoryBoards, So Xcode wont create Xib files for your viewController instead it will create a storyboard only. Here you dont want xib . Storyboard is replacement for the xib. If you unselect that feature you will get xib back. As a beginner you should go through several tutorial that uses both xib and storyboards.
Adding to Anil's answer, Storyboard is a replacement for the old .xib files.
I'm a newbie, and plainly started with a sample code from the book 'Beginning-iOS-5-Games-Development'.
Everything seems quite straight-forward, but i cant see the UIViewController subclass under the Cocoa touch for both ios/macos...
Would this have anything to do with the fact that the example is trying to work with Universal device type.
My Xcode version is 4.3.2, and im trying out ios5...
thanks for your help..
user
You have to select Objective-C class, then click Next. On the next screen, you can specify that the class you are making is a subclass of UIViewController.
I've started a new Navigation-based project in X-Code. I delete the default grid view, add a new blank view, and connect it to the File's Owner via ctrl+click+drag, and it builds fine, but before anything happens on the iPhone simulator or the real thing, I get "Thread 1: Program recieved signal: "SIGABRT"" when the program hits "[self.window makeKeyAndVisible]". I'm really new to Objective-C and X-Code, but I know quite a bit of C# and C++. I don't really understand if I've set something in the IDE wrong, or what...any help would be greatly appreciated. Thanks!
When you create a new navigation project, the RootViewController class is a subclass of UITableViewController. Your error is due to removing the UITableView from the xib file, and replacing it with a UIView.
To fix this, you should change the super class of RootViewController to UIViewController. (Don't forget to remove the UITableView datasource and delegate methods from the implementation file for clarity.)
i am currently starting to learn Xcode and objective-c and i am reading three different books on that topic currently. All of these books refer to a file called "AppDelegate" (My_First_ProjectAppDelegate.m, My_First_ProjectAppDelegate.h) which are said to be "created with the Project" (i am creating a "Cocoa Application"). These files are not present when I create a new Project. I seem to be not the only one having this problem (see http://pragprog.com/titles/dscpq/errata ).
Is there any more information about AppDelegate? What is the current practice on how to deal with a missing Appdelegate? i am using Xcode Version 3.1.4 on Mac OSX Leopard.
AppDelegate is nothing more than a common NSObject class with needed connections in MainMenu.xib. You can easily recreate your own:
Create a class, name it AppDelegate
Open MainMenu.xib and add NSObject object to object palette
In object inspector's Identity tab (the last one) set object's class to AppDelegate (you should get autocomplete)
Ctrl+drag from Application object to your newly created AppDelegate object and choose "delegate" from opened panel.
As I recall, only the iPhone templates were providing delegate classes by default. This is not a huge deal, but I can see how you would be concerned if you are just learning. Are you sure what you are reading is relevant to MacOS applications and not Iphone?
You can always create your own delegate class manually. You just create a class as you normally do, then set it as the delegate for NSApplication in Interface Builder.
I think the confusion comes from the version of XCode you are using.
Xcode version 3.2 changed the default behavior when you create a new project: it now creates an AppDelegate for your project. I can't remember what the earlier versions did, but it was different.
As Eimantas says, if you want to use an AppDelegate then you can just create one following the steps he describes.