Sunday, February 12, 2012

About initWithFrame and buttonWithType

There's two way to init UIButton

1.init by buttonWithType
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = frame;

2.init by initWithFrame
UIButton *button = [[[UIButton alloc] initWithFrame:CGRectMake(0.0f,0.0f,100.0f,45.0f)] autorelease];


note1:

Some peopel suggest using +buttonWithType,

because that's the only way to specify the button type.

If you use +alloc and -initWithFrame: methods,

the buttonType is set to some standard value and you can't change the type afterwards

because the buttonType property is read only.


note2:

buttonWithType returns an autoreleased UIButton.

This way you don't have to worry about releasing it.

On the other hand, you don't own it, so you cannot release it when you want to.





6 comments:

  1. cara menggugurkan kandungan banyak sekali jenisnya dari non medis ( alami ) dan medis.
    Tapi cara apakah yang paling aman dan baik bagi wanita untuk minum obat aborsi

    ReplyDelete
  2. I visit everyday some sites and sites to read articles or reviews, but this weblog provides quality based articles.
    obat aborsi
    obat aborsi semarang
    obat aborsi bandung
    obat aborsi jogja

    ReplyDelete
  3. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.!
    cara menggugurkan kandungan

    ReplyDelete
  4. It's actually a great and helpful piece of information. I am satisfied that you just shared this useful information for us.
    Thanks for sharing.
    obat aborsi

    ReplyDelete
  5. I feel this is among the such a lot vital info for me. And i am satisfied studying your article. However wanna commentary on few general things, The website style is ideal, the articles is truly nice
    Tangki Panel

    ReplyDelete
  6. I needed to create you one very little observation to finally thank you so much the moment again over the wonderful guidelines you have contributed in this case. It’s really tremendously open-handed of people like you to make unreservedly just what many individuals would’ve sold as an electronic book to help with making some bucks on their own, even more so considering the fact that you might well have done it in the event you wanted. The secrets as well acted to be the fantastic way to recognize that many people have the identical dreams the same as my personal own to figure out way more with reference to this problem. I believe there are many more fun instances in the future for individuals that examine your blog post.
    Jual Septic Tank

    ReplyDelete