그래서 5 개의 UIImageViews를 보유하도록 NSMutableArray를 선언합니다.iPhone UIImageView Array
.H 파일 다음하는 .m 파일에서
@interface ImageDisplay : UIViewController {
IBOutlet UIImageView *img1;
IBOutlet UIImageView *img2;
IBOutlet UIImageView *img3;
IBOutlet UIImageView *img4;
IBOutlet UIImageView *img5;
NSMutableArray *imageHolderArray;
}
@property (nonatomic, retain) IBOutlet UIImageView *img1;
@property (nonatomic, retain) IBOutlet UIImageView *img2;
@property (nonatomic, retain) IBOutlet UIImageView *img3;
@property (nonatomic, retain) IBOutlet UIImageView *img4;
@property (nonatomic, retain) IBOutlet UIImageView *img5;
@property (nonatomic, retain) IBOutlet NSMutableArray *imageHolderArray;
@end
:
//All objects are synthesized, just easier not to crowd the screen
- (void)viewDidLoad {
[super viewDidLoad];
imageHolderArray = [[NSMutableArray alloc] initWithObjects: img1,img2,img3,img4,img5,nil];
NSLog(@"imageHolderArray count: %i",[imageHolderArray count]); //Returns count of 1
}
그래서 제 질문은, 왜 이런 일이 있습니까? 배열의 모든 객체를 선택하지 않는 이유는 무엇입니까? 나는 Objective-C 프로그래밍에 정통하지 않으므로 누군가가 나를 여기에 실마리를 줄 수 있다면 고맙겠습니다. 고맙습니다.
imgN 참조가 nil이 아닌 것이 확실합니까? – teabot