[self.scrollView addSubview:[self.minkyImageView initWithImage:[UIImage imageNamed:@"monkey_1.png"]]];
I am adding an image to a scrollview like the above. My minkyImageView is attached to the scrollview on the UI builder and i also have the outlet connected. However when run the code i dont see the image unless i set the image on the UI builder. I dont want to do this since i want to change images every time a scroll takes place so therefore i need to customize it via code. So what am i doing wrong? I am writing this method in viewdidload.
you should not call init more than one time. And
initshould always called in conjunction (i.e. on the same line) withalloc.why don’t you use
self.minkyImageView.image = [UIImage imageNamed:@"monkey_1.png"];