inside the UIViewController, the tempview2 is not showing up at all. only tempview is showing up.
-(id) init:(NSData*) imageData { if ((self = [super init])) { tempimage= [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pic1" ofType:@"png"]] autorelease]; tempview=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]; [tempview setImage:tempimage]; [self.view addsubview tempview]; } return self; } -(void) viewdidload{ tempimage2= [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pic2" ofType:@"png"]] autorelease]; tempview2=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]; [tempview2 setImage:tempimage2]; [self.view addsubview tempview2]; }
if I do this then everything is OK,
-(id) init:(NSData*) imageData { if ((self = [super init])) { tempimage= [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pic1" ofType:@"png"]] autorelease]; tempview=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]; [tempview setImage:tempimage]; [self.view addsubview tempview]; tempimage2= [[[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pic2" ofType:@"png"]] autorelease]; tempview2=[[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)] autorelease]; [tempview2 setImage:tempimage2]; [self.view addsubview tempview2]; } return self; }