IOS 8: Keyword new vs. Alloc, Init

Source: Internet
Author: User

Keyword: New alloc init

An object instantiated with the new keyword, which automatically calls the Init method after allocation, returns an object that can be used immediately, with the disadvantage that the custom Init method cannot be called because repeated initialization can cause unpredictable problems.

With Alloc, you can invoke the custom Init method, although you will have to call Init again.

Summarize:

If it's just [[Class Alloc] init], then the effect is exactly the same as [class new].

Reference:

http://blog.csdn.net/folish_audi/article/details/39890825

IOS 8: Keyword new vs. Alloc, Init

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.