I have a class that subclasses UIView called DrawView. This class contains custom drawing in the drawRect: method. I want to add this to a UIScrollView programmatically in a UIViewController class controlling the view which the UIScrollView has been added to. Also, I want the instance of DrawView to be a global variable.
I kind of confused and I am not really sure of anything, except that at some point I will have to call [scroller addSubview:drawViewInstance];. Thanks
Yes what you have written is correct. Also your subview should be a new class overriding the methods you need. You can maintain it globally by providing a method to return the instance more like a singleton.
Put the variable into the app delegate class. Alloc and init it and you can access it using the getter. Declare the variable in your delegate.