I have an IBOutlet to a UIImageView, but when I look at the UIImageView doc, I can\'t see any hints about programmatically changing it
Note that the NIB file doesn't wire up all the IBOutlets until the view has been added to the scene. If you're wiring things up manually (which you might be doing if things are in separate NIBs) this is important to keep in mind.
So if my test view controller has an "imageView" wired by a nib, this probably won't work:
testCardViewController.imageView.image = [UIImage imageNamed:@"EmptyCard.png"];
[self.view addSubview:testCardViewController.view];
But this will:
[self.view addSubview:testCardViewController.view];
testCardViewController.imageView.image = [UIImage imageNamed:@"EmptyCard.png"];
If you want to set image to UIImageView programmatically then Dont Forget to add UIImageView as SubView to the main View.
And also dont forgot to set ImageView Frame.
here is the code
UIImageView *myImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
myImage.image = [UIImage imageNamed:@"myImage.png"];
[self.view addSubview:myImage];
To set image on your imageView use below line of code,
self.imgObj.image=[UIImage imageNamed:@"yourImage.png"];
imageView.image = [UIImage imageNamed:@"myImage.png"];
myUIImageview.image = UIImage (named:"myImage.png")
UIColor * background = [[UIColor alloc] initWithPatternImage:
[UIImage imageNamed:@"anImage.png"]];
self.view.backgroundColor = background;
[background release];