Can't hook up an outlet collection in Xcode 6 using storyboard

后端 未结 4 708
北荒
北荒 2020-12-10 17:03

I am having trouble creating an outlet collection in Xcode 6. Outlet collections in Xcode 6 now function as regular IBOutlets, and you use the same @IBOutlet attribute to de

4条回答
  •  隐瞒了意图╮
    2020-12-10 17:26

    In seed 3 of Xcode 6, the following syntax works:

    @IBOutlet strong var cardButtons: NSArray?
    

    Note the following:

    • You have to use strong because @IBOutlet is weak by default, and since the array is not in the interface, it will vanish before you have a chance to use it.

    • You have to use NSArray because you can't mark Array as strong.

    Knowing the contained type is now up to you, of course.

    Note also that this is not the syntax advertised by the docs or by Xcode itself when you control-drag to form an outlet collection. I can't help that; using that syntax causes a seg fault, so clearly something else is needed, at least for now.

提交回复
热议问题