Xcode 4: Creating a UIView xib, not properly connecting

前端 未结 30 3494
时光说笑
时光说笑 2020-12-02 16:29

I\'m trying to create a nib that contains a view that will be embedded in a TableViewCell. I\'ve created the interface and implementation files, ResultCell.h an

30条回答
  •  星月不相逢
    2020-12-02 16:53

    Using Swift, I had a similar problem. I found out that the comments were part of the problem for me.

    I leveraged the default view controller, did some work in it, then created a second view controller by copying the entire first one, stripping it down to only viewDidLoad() and renaming the class to TestViewController. Builds worked, code executed. All was good.

    When I went to drag a UITextField in to create an outlet, it would not let me. I noticed that my comments still said "ViewController.swift", so I changed the comment text to "TestViewController.swift" and rebuilt. I was able to connect my outlet!

    I wonder if what occurred is that the Indexer was reading the comments as well as the class names, and somehow got confused.

提交回复
热议问题