I'm following the "Intro to App Development with Swift" in iBooks and in one of the tutorials it tells me to drag a new View from the Object Library onto the View Controller in the stroryboard of a single-view App. But, xcode won't accept the drag -- nothing takes effect. How do I drag a view object from the object library onto the view controller of a newly opened single-view app project?
Accepted Reply
Thanx... Turns out, I was just making a total newbie mistake -- instead of the object library, I had the file template library selected which also has entries called "View" that look like the picture in the book :-(
Replies
For it to work, you must have declared the class in IB.
- If your class is named MyViewController
class MyViewController: UIViewController { … }
- Then, in IB,
select the viewController
Go to Identity Inspector
At the top, in class, type MyViewController, then return
Now IB knows the viewController corresponds to the class to which you want to drag ; so, should be able to drag
Thanx... Turns out, I was just making a total newbie mistake -- instead of the object library, I had the file template library selected which also has entries called "View" that look like the picture in the book :-(
Thanks for feedback.
But for the future, be more clear when you describe your problem. You should have explained what type of object you tried to drag. BTW, doing so, you would have understod immediately the mistake.
And don't forget to close the thread by marking the correct answer.