开发者

how to display images in imageview in iphone

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 th开发者_JS百科is imageview.

Thank u in advance.


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


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).


imageview1 = [[UIImageView alloc] init];
imageview1.image = [UIImage imageNamed:@"wolf.jpg"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜