ioscocoa-touchviewxiboutlet

Can't set view outlet in xib


I have a xib file that includes a view controller but I have the same problem as this link: problem

In this answer they can easily set outlet because view has a circle that is clickable.But in my case the view outlet is not even clickable.So I can't set the outlet.What to do now?


Solution

  • The correct way to use initWithNibName:: is to have a "View" IB document where you have the desired VC view outlet as a root element. You need to set the "File's Owner" "Class" to your UIViewController subclass and connect it's view outlet: enter image description here

    Also, don't present modal VC from self at viewDidLoad: at the time of this method execution the VC is often not yet presented itself, viewDidAppear: is more fitting for such tests.