2

Iam new to iphone currently my problem is

i displayed 6 images in 6 image views It was not showing images in imageview I think the imageviews are in large size

i implement code like this.

imageview1 = [[UIImageView alloc] init];
UIImage *img1 = [UIImage imageNamed:@"wolf.jpg"];
[imageview2 setImage:img1];

so plz send me correct code for this imageview.

Thank u in advance.

Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97
user549767
  • 437
  • 3
  • 7
  • 17
  • It's important to accept answers to your questions. Please go back to your other questions where you received a useful answer and click the gray checkmark next to the answer that helped you the most. – Matthew Frederick Dec 23 '10 at 10:57
  • Did any of these answers work out for you? Please accept one by clicking on the gray checkmark next to the answer if so. – Matthew Frederick Dec 29 '10 at 20:20

3 Answers3

7
bgImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,480,300)];
bgImage.image = [UIImage imageNamed:@"Default.png"];
[self.view addSubview:bgImage];

Also check have you add image file to your project, by Add - > Existing File

Flexo
  • 87,323
  • 22
  • 191
  • 272
Kamleshwar
  • 2,967
  • 1
  • 25
  • 27
1

First of all, you're adding the image 1 to imageview 2 - are you sure you want to do this?

Secondly, you need to add the imagview to the view hierarchy, for example by adding it to a ViewControllers view, like this: [[self view] addSubview:imageview1] (If this code is situated within the View Controller class).

Toastor
  • 8,980
  • 4
  • 50
  • 82
0
imageview1 = [[UIImageView alloc] init];
imageview1.image = [UIImage imageNamed:@"wolf.jpg"];
Matthew Frederick
  • 22,245
  • 10
  • 71
  • 97