Instance member cannot be used on type

来源:互联网 发布:统计台账数据 编辑:程序博客网 时间:2024/06/06 17:21

reason:
The error is because the type tries to access the self property before self was initialized (initialization happens after defining the values for properties).

Solution:
define first before initialization and then set its value after initialization, for example in viewDidLoad function

private var imageList : NSMutableArray = [] //define

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

    imageList = NSMutableArray(capacity: usersNumber)    }
0 0
原创粉丝点击