UIImageView

Creating a view for images

UIImage *image = [UIImage imageNamed:@"image.png"];
UIImageView *theImageView = [[UIImageView alloc] initWithImage:image];

Comments

Anonymous said…
I have a view that I want to display some animation on. That view has an ImageView object that loads an array of PNG images into it's animationImages property.But the app crashs showing signal 0 error
Test said…
I Think this is because you are using an older version of xcode and very new to iPhone SDK pls update with latest one
Anonymous said…
adding a image on another image to form one image


UIImage* bottomImage = [UIImage imageNamed:@"bottom.png"];
UIImage* topImage = [UIImageNamed:@"top.png"];
UIImageView* imageView = [[UIImageView alloc] initWithImage:bottomImage];
UIImageView* subView = [[UIImageView alloc] initWithImage:topImage];
subView.alpha = 0.5; // Customize the opacity of the top image.
[imageView addSubview:subView];
UIGraphicsBeginImageContext(imageView.frame.size);
[imageView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* blendedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[subView release];
[imageView release];

[self doWhateverIWantWith: blendedImage];
Anonymous said…
your source for mac and iphone cocoa code samples
iPhone : warning: no ‘-renderInContext:’ method found – solution

with one comment
for above comment

There is a simple solution to this pesky warning:

1. Add the following to your .h file :
#import
2. You may also need to add “CoreGraphics.framework” to your project, if its not already there.