开发者

How to call - (id)initWithFrame:(CGRect)frame function?

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 it开发者_开发问答s intialized state?


You should not call -init methods 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. -setupDefaultProperties and call it in your initWithFrame method and whenever you want to reset the view to its initial state

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜