UIImage and UIImageview
A UIImage is an object that holds a picture. It is generally set on a UIImageView, UITableViewCell, etc.
Example
UIView *myView =
[ [UIView alloc]
initWithFrame:[[UIScreen mainScreen]
applicationFrame]
];
self.view = myView;
[myView release];
NSString *path = @"myimage.png";
UIImage *theImage =
[UIImage imageNamed:path];
UIImageView *myImageView =
[[UIImageView alloc]
initWithFrame:CGRectMake(0,381,60,30)];
[myImageView setImage:theImage];
myImageView.userInteractionEnabled = NO;
[myView addSubview:myImageView];
[myImageView release];
// you can change it's location on
// the screen by calling it's
// setFrame: method.
// [myImageView setFrame:
// CGRectMake(100,200,60,30)];
// you can also load an image from the net
UIImage *theImage = nil;
NSString *urlString =
@"http://www.myweb.com/myimage.png";
NSURL *imageURL =
[NSURL URLWithString:urlString];
NSData *imageData =
[NSData
dataWithContentsOfURL:imageURL];
theImage = [[UIImage alloc]
initWithData:imageData];
How do I rotate the image?
CGAffineTransform transform =
CGAffineTransformMakeRotation(angle/180.0 * 3.14159265358979323846264338327950288);
myImageView.transform = transform;