Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 我想让imageView的位置垂直颠倒_Iphone_Objective C_Ios_Ios6 - Fatal编程技术网

Iphone 我想让imageView的位置垂直颠倒

Iphone 我想让imageView的位置垂直颠倒,iphone,objective-c,ios,ios6,Iphone,Objective C,Ios,Ios6,下图中有两个图像视图,一个是身体图像视图,另一个是黑色纹身图像视图, 现在我用下面的代码获得tatoo imageView位置 appDelegate.xFloat= self.imgView.frame.origin.x; appDelegate.yFloat= self.imgView.frame.origin.y; appDelegate.widthFloat= self.imgView.frame.size.width; appDelegate.heightFloat= self.img

下图中有两个图像视图,一个是身体图像视图,另一个是黑色纹身图像视图, 现在我用下面的代码获得tatoo imageView位置

appDelegate.xFloat= self.imgView.frame.origin.x;
appDelegate.yFloat= self.imgView.frame.origin.y;
appDelegate.widthFloat= self.imgView.frame.size.width;
appDelegate.heightFloat= self.imgView.frame.size.height;
现在我需要将纹身图像放在另一个视图控制器中,正如我们在图像中看到的一样,这里的汽车处于反向位置,但在appDelegate.xFloat、appDelegate.yFloat、appDelegate.widthFloat、appDelegate.heightFloat的帮助下,我正在设置纹身图像视图框架。 但我在另一个视图中得到的图像如下所示

我需要把汽车图像放在相反的位置,就像我们在第一张图像中看到的那样。 请引导我

我的要求不仅仅是轮换。。图像可以位于如下所示的任何位置


在使用构造函数appDelegate之前,必须先使用它。 作者:


奇怪的是,一个图像没有旋转,而另一个图像正在旋转。我假设其中一个图像是背景图像或其他任何图像,但是可以使用变换属性来更改旋转。类似于下面代码的东西应该在两个方向上显示相同的图像

UIImage *image = [UIImage imageNamed:@"image.png"];

UIImageView *iv1 =[[UIImageView alloc] initWithImage:image];

[self.view addSubview:iv1];

UIImageView *iv2 = [[UIImageView alloc] initWithImage:image];

[iv2 setFrame:CGRectMake(100,100,image.size.width,image.size.height)];

[iv2 setTransform:CGAffineTransformMakeRotation(-M_PI)];

[self.view addSubview:iv2];

巴布尔,看起来你在试图创造一个形象。为此,您需要使用一些称为ImageContext的东西。我已经给出了一些代码,你在上下文中画一个图像,然后把图像拿出来

UIGraphicsBeginImageContext(CGSizeMake(300,300));

UIImage *image = [UIImage imageNamed:@"breakpoint place.png"];

[image drawAtPoint:CGPointMake(0,0)];

UIImage *image2 = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageView *iv = [[UIImageView alloc] initWithImage:image2];

[iv setFrame:CGRectMake(100,100,image2.size.width,image2.size.height)];

[self.view addSubview:iv];

我在我的ViewDidLoad中做了这件事,我也得到了纹身图像视图的位置。。。但是我想要塔图的图像,就像汽车倒车一样……但是我得到的是实际的汽车图像。。。。。。。。我还尝试了另一种方法,即在导航到另一个视图时保存图像。但我没有得到解决方案@Chu chau您是否尝试使用UIView.transform将图像倒置?我没有使用,因为UIView.transform可能会旋转图像。。但我们不知道用户如何旋转图像。。所以,我需要得到那个图像,我想把它放在另一个视图控制器@user1781290hi Sri中,请看一下编辑过的问题。我想要的图像是不断变化的time@SrikanthSo您如何接受用户输入。您可以阅读有关旋转手势的信息,并将旋转手势添加到UIImageView。这样,您可以允许用户旋转它,一旦他完成旋转,图像就可以处于该位置。也许你也可以提供更多关于你想做什么的细节。我不接受任何输入,通过手势它是旋转的。。。完成旋转后,我想将该图像准确地保存到UIImage@Srikanthi中。我保存的图像通常与UIImage*img=self.imageView.image一样;但我得到的是旧的图像,而不是应用手势@Srikanth的图像
UIGraphicsBeginImageContext(CGSizeMake(300,300));

UIImage *image = [UIImage imageNamed:@"breakpoint place.png"];

[image drawAtPoint:CGPointMake(0,0)];

UIImage *image2 = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImageView *iv = [[UIImageView alloc] initWithImage:image2];

[iv setFrame:CGRectMake(100,100,image2.size.width,image2.size.height)];

[self.view addSubview:iv];