Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewcontroller.h File Instead of View Controller

Tags:

xcode

ios

swift

I have a project in Xcode 8 in which I am using one view controller when i try to add another view controller i get a viewcontroller.h which i cannot edit or unlock. Why is this happening? Can I use more than one View Controller in a project? If you know how to create another View Controller please answer.

Thank you in advance

like image 791
Shakespear123 2 Avatar asked Feb 15 '26 10:02

Shakespear123 2


1 Answers

You can have as many viewcontrollers in project as long as you name them uniquely. Follow the steps: 1) Right click on folder in which you want to create a viewcontroller 2) Select New File option 3) In the "Choose a template for your view file" select source in ios & click on "cocoa touch class" --> tap Next 4)In next window Enter "Class" which will be name of your new view controller & in "Subclass of" make sure you select "UIViewController" class. Select "Language" as Objective-c & then click Next 5) In next window click "create" button

That is all you have to do.

like image 90
Mukund Sonaiya Avatar answered Feb 16 '26 22:02

Mukund Sonaiya