명확성을 위해 Java 명세서에 따라 대답하겠습니까 :
//Java:
JLabel l1=new JLabel();
//Objective C:
UIImageView * l1= [[UIImageView alloc] init];
//Java:
JLabel l2=new JLabel();
//Objective C:
UIImageView * l2 = [[UIImageView alloc] init];
//Java
JLabel [] arrayOfLabels = new JLabel[2];
//Objective C
NSMutableArray * imagesArray = [[NSMutableArray alloc] init];
//Java
arrayOfLabel[0] = l1;
//Objective C
[imagesArray addObject:l1];
//Java
arrayOfLabel[1] = l2;
//Objective C
[imagesArray addObject:l2];
당신이 (내가 당신의 코멘트에서 그것을 짐작) ARC를 사용하지 않는 그래서 그러므로이 같은 메모리 관리의 일환으로 수동으로 일을 해제해야하기 때문에 :
[l1 release]; //After adding it to imagesArray
[l2 release]; //After adding it to imagesArray
그리고 imagesArray
때 돈을 해제 필요 없어. 일반적으로 그것은 dealloc()
에서 이루어집니다,하지만 당신은 당신이 단순히 호출하여 추가로 필요하지 않는 시점에서 해제 할 수 있습니다 :
[imagesArray release];
imagesArray = nil;
희망 그래서 이것은 당신을 도울 것입니다.
어디에서 많은 이미지 뷰를 보유하고 있습니까? 어떻게 정의됩니까? – Wain