Closed psajja closed 9 years ago
A view controller's properties can be access through "self".
I think he meant from a custom class how do you access the View Controller's properties.
Please give an example of what you'd like to do. You might not be conforming to a MVC pattern.
I meant from the custom class to access view controllers properties.
I have two classes i.e. the viewcontroller class (which came free with single view application) and XOImageView class (a custom class i created). I have added 9 properties of UIView for each of the 9 block of tie tac toe set their frame sizes. In XOImageView is intended for the X and O images. I have added code for the UIPanGesturerecognizer in XOImageView. Now, I would like to check in the PanGesturerecognizer if the image's frame has intersected with any of the nine UIView I created in the viewcontroller. I would like to have access to the 9 UIView's i created in the viewcontroller in the XOImageView class.
Why don't you move your UIPanGesturerecognizer code to your view controller?
I tried to do that by setting the delegate in XOImageView initwithFrame method. [panGesture setDelegate: ViewController];
But shows up as an error "unexpected user interface name "ViewController".
I would have to see your code, I'm not sure what you're doing. I will be at office hours today in Crerar 4pm.
Thanks Jonny. I am out of town. I will not be able to make it. I will see you on thursday or friday.
Hi, I have created a project with single view application and I have added some new properties to the viewcontroller programmatically. I have also created a custom class and in one of its methods, I would like to access the properties of the view controller. I know how to access the properties of an object, but in this case, I am not sure what the object name of the viewcontroller would be?