Daniil Gavrilov
Daniil Gavrilov

Reputation: 47

Can't get access to custom UIView property

I have UIView subclass

class GraphView: UIView {
    var test = false
}

And when I'm trying to get access to the test property via @IBOutlet, I get exc_bad_access error.

What is my problem?

Upvotes: 0

Views: 244

Answers (2)

Ungrace
Ungrace

Reputation: 304

I just had this issue. It turned out the viewController's view was connected to the IBOutlet, instead of my custom view

Upvotes: 1

charush nair
charush nair

Reputation: 53

The reason can be, you are trying to access the property of the @IBOutlet before the view has loaded.@IBOutlet is initialised only when view containing the outlet is loaded.

Upvotes: 1

Related Questions