Class has no initializers Swift

后端 未结 7 1335
迷失自我
迷失自我 2020-11-28 22:17

I have a problem with Swift class. I have a swift file for UITableViewController class and UITableViewCell class. My problem is the UITableViewCell class, and outlets. This

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 22:37

    You have to use implicitly unwrapped optionals so that Swift can cope with circular dependencies (parent <-> child of the UI components in this case) during the initialization phase.

    @IBOutlet var imgBook: UIImageView!
    @IBOutlet var titleBook: UILabel!
    @IBOutlet var pageBook: UILabel!
    

    Read this doc, they explain it all nicely.

提交回复
热议问题