iphone - UIButton - should we release or not? -


OK let me explain the situation.

I want to add a button to a view dynamically here is the code.

  UIButton * x = [UIButtonTypeRoundedRect] with UIButton Button;  

Here, I have not used the "alloc" function.

The question has been followed for this statement.

  • If we are using Image View for the same situation, let us create a temporary image view of your current view & amp; Leave it What to do for the button?
  • How buttons are allocated & amp; De-allocated?
  • If buttons are allocated? How has this been remembered?
  • Now when I use [x release]; - Is this right or wrong?

Thank you in advance for sharing your great knowledge.

Sea.

There is no allocation / init or new, when it is no longer necessary then it will be autoraxed. When you add it to UIView, the count increases and is kept by the view, even if the view is released.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -