Hello.
I have a UIViewController with a subclassed UIView in it (that draws a graph). The strange problem is that in the viewWillAppear method of the UIViewController, one of my global variables that determines how the image will be drawn in the UIView is passed correctly, whereas in the UIView subclass, it is not.
Let me explain.
My UIViewController:
My ViewController:
override func viewWillAppear(animated: Bool)
{
print("WILLAPPEAR AND WHAT IS DATA HERE? ",appSingleton.isWindAloftUSShared )
self.viewWindFrame.setNeedsDisplay()
}
My UIView subclass:
class IGAWindAloftDrawView: UIView
{
override func drawRect(rect: CGRect)
{
print("THIS IS PASSED",appSingleton.isWindAloftUSShared)
if appSingleton.isWindAloftUSShared == true
{
draw1()
}
else if appSingleton.isWindAloftUSShared == false
{
draw2()
}
}
}
The global property is always true in the UIView subclass for some reason:
WILLAPPEAR AND WHAT IS DATA HERE? false
THIS IS PASSED true
I have checked the classes and I do not seem to be assigning the value back to true anywhere in the subclass or the UIViewController.
Thanks a lot in advance if someone has an idea what may be happening!