UIImage *image = [UIImageimageNamed:@"addcamera_scanning_area.png"];
UIImageView *imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake((MAINSCREEN_WIDTH - scanRectWidth)/2.0,EXTRA_HEADER_HEIGHT, imageWidth, imageHeight)];//左上
imageView.image = image;
[self.viewaddSubview:imageView];
[imageViewrelease];
imageView = [ [UIImageView alloc ] initWithFrame:CGRectMake((MAINSCREEN_WIDTH - scanRectWidth)/2.0,MAINSCREEN_HEIGHT - imageHeight, imageWidth, imageHeight)];//左下
imageView.image = image;
[self.viewaddSubview:imageView];
[imageViewrelease];
// 旋转
CGAffineTransform rotate =CGAffineTransformMakeRotation( 270.0 /180.0 * M_PI );
[imageViewsetTransform:rotate];
imageView = [ [UIImageView alloc ] initWithFrame:CGRectMake((MAINSCREEN_WIDTH - scanRectWidth)/2.0 + scanRectWidth - imageWidth, MAINSCREEN_HEIGHT - imageHeight, imageWidth, imageHeight)];//右下
imageView.image = image;
[self.viewaddSubview:imageView];
[imageViewrelease];
// 旋转
rotate = CGAffineTransformMakeRotation(M_PI );
[imageViewsetTransform:rotate];
imageView = [ [UIImageView alloc ] initWithFrame:CGRectMake((MAINSCREEN_WIDTH - scanRectWidth)/2.0 + scanRectWidth - imageWidth, EXTRA_HEADER_HEIGHT, imageWidth, imageHeight)];//右上
imageView.image = image;
[self.viewaddSubview:imageView];
[imageViewrelease];
// 旋转
rotate = CGAffineTransformMakeRotation(90.0 / 180.0 * M_PI );
[imageViewsetTransform:rotate];
本文介绍如何使用Objective-C在不同的位置添加UIImage并进行旋转操作,包括左上、左下、右下及右上的布局方式,并提供了具体的代码实现。

101

被折叠的 条评论
为什么被折叠?



