Try the search, it's linked to some great forums

Tuesday, June 21, 2011

Adding a photo (jpg) to a UIView

This technique is used to load a jpg or png file located in the resources directory into a UIView where all sorts of fun can be had;
//Gets photo name
    UIImage *rightPhoto = [UIImage imageNamed:@"image6.jpg"];
   
 //Configure and place image
    UIImageView *rightImage = [[UIImageView alloc] init];
    CGRect rightFrame = CGRectMake(800.0, 390.0, 200.0, 150.0);
    rightImage.frame = rightFrame;
    rightImage.image = rightPhoto;
   
 //Apply the Images to the view
    UIView *rightPostCard = [[UIView alloc] init];
    [rightPostCard addSubview:rightImage];
    [self.view addSubview:rightPostCard];
    [rightImage release];