Can't connect IBOutlet in Interface Builder

前端 未结 19 2081
别跟我提以往
别跟我提以往 2020-12-04 20:02

I\'m having a weird experience. I create any type of iPhone application, add a UIViewController with Xib file. I can edit the xib file with controls and see them rendered if

19条回答
  •  囚心锁ツ
    2020-12-04 20:20

    Did you make sure you are defining your outlets in your .h file as the appropriate type? If you are trying to connect a text field in IB, then your .h file should look something like...

    IBOutlet UITextField    *MyTextField;
    

    Make sure the type is UITextField (or UITextView, etc). If you type them as NSString or anything the is not appropriate, then you can't connect them in Interface Builder....

提交回复
热议问题