Tag: 旋转

旋转视图iPhone的tabbar应用程序

我有一个包含一个tabbar控制器和一些不同的意见的主窗口的应用程序。 我希望整个事情能够在每个方向旋转,但是做 – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } 没有帮助,而这确实在其他应用程序工作。

在iOS上使用animation旋转UIImageView 180度以上

我试图通过旋转超过180度animation移动米,但它不会工作。 我使用CGAffineTransform旋转仪表,它使用净结果进行旋转。 这意味着使用此function时,我不能selectCW或CCW旋转。 我怎样才能修改这个代码,使其旋转4弧度。 目前旋转被转换为净结果,使旋转最小化。 [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:1.25]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; CGAffineTransform transform = CGAffineTransformMakeRotation(4); self.meter.transform = transform; [UIView commitAnimations]; 编辑:从答案我设法得到它通过这样做的工作 [UIView animateWithDuration:1.5 animations:^{ CABasicAnimation *fullRotation; fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; fullRotation.fromValue = [NSNumber numberWithFloat:0]; fullRotation.toValue = [NSNumber numberWithFloat:((330*M_PI)/180)]; fullRotation.duration = 2.0f; fullRotation.repeatCount = 1; fullRotation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; fullRotation.fillMode = kCAFillModeForwards; fullRotation.removedOnCompletion = NO; […]

旋转imageView,同时移动它

所以我有一个名为图像的UIView ,我试图让它旋转,而我上下移动视图,这是我迄今为止所做的,但它使图片旋转,而不是下降: { return centerY – height / 2 <= 10 || centerY + height/ 2 >= self.view.bounds.size.height – 10; } -(void)moveUpDownTimerCallback { [UIView commitAnimations]; verticalSpeed += acceleration; degrees+=degreechange; CGSize sz = image.bounds.size; image.transform = CGAffineTransformMakeRotation(degrees * M_PI/180),image.layer.anchorPoint = CGPointMake(rotPointx/sz.width,rotPointy/sz.height);rotPointy = image.center.y; rotPointx = image.center.x; CGPoint newCenter = CGPointMake(image.center.x, image.center.y + verticalSpeed); if ([self hasCollided: […]

UIActivityViewControllerclosures后的正确方向

我从我的控制器呈现UIActivityViewController。 我遇到了旋转问题。 在select了一些数据共享选项之后,让我们说“邮件”,邮件撰写视图控制器被呈现。 但是,如果我旋转设备并closures邮件控制器之后,我的VC不旋转到当前的方向。 我已经尝试为UIActivityViewController设置完成处理程序,如下所示: 1) [activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed){ [UIViewController attemptRotationToDeviceOrientation]; }]; 要么 2) [activityViewController setCompletionHandler:^(NSString *activityType, BOOL completed){ UIInterfaceOrientation currentOrientation = [[UIApplication sharedApplication] statusBarOrientation]; [self layoutForInterfaceOrientation:currentOrientation]; }]; 第一个解决scheme根本没有帮助。 第二个解决scheme留下导航栏不旋转(高度差12个点)。 请告知如何处理这种情况。

旋转GPUImageTiltShiftFilter – GPUImage

我想要一个非水平的GPUImageTiltShiftFilter旋转。 我想旋转到任意的旋转angular度。 我也想要filter是快速的,它可以与UIRotationGestureRecongizer用户界面旋转。 我该怎么做呢?

UIWebView自动旋转损坏网页视图内容(截图里面)

我有一个UIWebView自动旋转的问题。 Web视图可以正常显示,但内容不是。 正如你可以在底部的屏幕截图中看到,有一个黑色的边缘,我知道这是webview,因为我可以看到滚动当我滚动。 视图控制器有: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } webview具有完整的自动resize掩码,并且该视图是自动调整子视图的大小。 我尝试了一堆来自stackoverflow和谷歌的技巧,但没有一个工作。 这只发生在一些网站上,但如果我打开有问题的网站在移动Safari或甚至ios Opera浏览器,它正确旋转。 编辑:一个有问题的网站的例子: http : //m.calcalist.co.il webview在界面构build器中设置并使用以下代码加载: [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://m.calcalist.co.il"]]]; scalesPageToFit = YES; // doesn't help 谢谢!

如何在单个animation中缩放和旋转视图

我试图通过从屏幕的中心出现一个视图,同时将其增大到全尺寸,同时以3D方式围绕X轴旋转。 当我创build视图时,我会对其应用一个转换,以确保它缩小并旋转,从而开始(实际上不可见),然后尝试使用CATransform3D,如下所示: CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"transform"]; CATransform3D transform = CATransform3DRotate(view.layer.transform, M_PI, 1.0, 0, 0); transform = CATransform3DScale(transform, 1000, 1000, 1000); transform.m34 = 1.0 / 10000; [anim setToValue:[NSValue valueWithCATransform3D:transform]]; [anim setDuration:0.75f]; anim.removedOnCompletion = NO; anim.delegate = self; [view.layer addAnimation:anim forKey:@"grow"]; 然而这个animation不会改变图层的实际转换,所以我也这样做: – (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag { view.layer.transform = CATransform3DIdentity; [view.layer removeAllAnimations]; } 一旦animation停止,就设置变换。 但是,这有时会导致animation结束时出现明显的闪烁。 我相信这是因为animation将原始变换放回到animation阶段的末尾,并且在animationDidStop例程被调用之前发生。 […]

如何获得完美的旋转UIView的X,Y位置在ios中

我正在使用CABasicanimation旋转UIView。 我正在使用这个代码, CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; NSNumber *currentAngle = [CircleView.layer.presentationLayer valueForKeyPath:@"transform.rotation"]; rotationAnimation.fromValue = currentAngle; rotationAnimation.toValue = @(50*M_PI); rotationAnimation.duration = 50.0f; // this might be too fast rotationAnimation.repeatCount = HUGE_VALF; // HUGE_VALF is defined in math.h so import it [CircleView.layer addAnimation:rotationAnimation forKey:@"rotationAnimationleft"]; 在这个我想要完美的X,Y位置,而“UIView”旋转。 如果有人知道请帮助我。 先谢谢你。

现有的UITableView照片网格不能正确旋转?

我试图做一个基本的照片网格,这是一个“网格”的小“缩略图”图像,当点击去一个大版本的图像。 我正在使用UITableView来完成这一点。 我的问题是,当我尝试添加旋转支持,我不能让表格重绘与额外的一排图像网格。 这里是我的一些代码,请随时提出任何问题,因为我在我的智慧结束这一个> 🙁 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil){ cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if(self.interfaceOrientation==UIInterfaceOrientationPortrait || self.interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown){ NSLog(@"portrait"); for (int i=0; i < self.numberOfColumns; i++) { if (self.photoIndex < [self.photosArray count] || self.shouldReload==TRUE) { UIButton *imageButton = [[UIButton alloc]init]; UIActivityIndicatorView *loadingActivityIndicator = […]

当我尝试在多达100个图像上执行旋转屏幕时,CIIImage会泄漏

当我使用下面的方法(在ARC下)内存分配迅速增长到125 Mo以上。 我已经使用CGImage来实现它,但是速度很慢。 imageArray包含125个大小为640×80的UIImage。 -(void)rotateAndTransform{ int j=0; context = [CIContext contextWithOptions:nil]; for(UIImage* item in imageArray) { CGImageRef intermed =[item CGImage]; CIImage *begin = [CIImage imageWithCGImage:intermed]; CGAffineTransform transform = CGAffineTransformMakeRotation(-M_PI/2); CIImage *outputImage = [ begin imageByApplyingTransform:transform]; CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]]; UIImage *newImg = [UIImage imageWithCGImage:cgimg]; CGImageRelease(cgimg); [self.imagesFromExtract addObject:newImg]; j++; } }