I am creating a UIView class . in the implementation there is a function
- (id)initWithFrame:(CGRect)frame
I am adding a button in the class which is used to reload the class.
I would like to call the class initialization function when the button is pressed so that the view is refreshed and it comes back to its intialization state.
Is there a function which can be used to roll back the view to its intialized state?
You should not call
-initmethods more then once for the same object.The solution for your problem however is simple – move all your setting properties code to a separate function, e.g.
-setupDefaultPropertiesand call it in your initWithFrame method and whenever you want to reset the view to its initial state