Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
[[UIImageView new] init] と [[UIImageView alloc] init] の違いは何だろうと思っています。
[[UIImageView new] init] にもメモリが割り当てられていますか?
+ newは、その後に+ alloc続くと同等です。- init
+ new
+ alloc
- init
UIImageView *iv = [[UIImageView alloc] init];
と
UIImageView *iv = [UIImageView new];
正しい (および同等) であり、
UIImageView *iv = [[UIImageView new] init];
2回呼び出すため、間違っています。- init