I have a UIView added to my rootViewController, the UIView detects touches and using their coordinates returns me a specific Integer, however I dont know how to return this integer to my rootViewController. I read somewhere that the MVC says that the UIView should not know about the viewcontroller, is this true? if So how might I accomplish this? Thanks!
I have a UIView added to my rootViewController, the UIView detects touches and using
Share
I recomend you to define a protocol for passing the Integer between them. Make your view controller implement the protocol and assign it to the view. Then, from the view, fire the protocol method with the desired value.
Protocol example:
View controller (.h) example:
View controller (.m) example:
View example: