首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >向后移动和缩放反弹

向后移动和缩放反弹
EN

Stack Overflow用户
提问于 2013-07-20 21:07:48
回答 1查看 337关注 0票数 3

正如您在this video中看到的,每当我尝试裁剪或移动裁剪框时,它都会弹回。我找不到任何方法来做到这一点,我认为我的代码是正确的。我该怎么做呢?

代码语言:javascript
运行
复制
- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                          message:@"Device has no camera"
                                                         delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles: nil];
    [myAlertView show];
  }
}

- (IBAction)takePhoto:(UIButton *)sender {
  UIImagePickerController *picker = [[UIImagePickerController alloc] init];
  picker.delegate = self;
  picker.allowsEditing = YES;
  picker.sourceType = UIImagePickerControllerSourceTypeCamera;
  [self presentViewController:picker animated:YES completion:NULL];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
  UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
  self.imageView.image = chosenImage;
  [picker dismissViewControllerAnimated:YES completion:NULL];
}
EN

回答 1

Stack Overflow用户

发布于 2013-07-20 21:21:59

如果图像距离太远,请使用此方法将其重新设置为动画:

代码语言:javascript
运行
复制
[UIView animateWithDuration: animations: completion:]

动画:是一个块,如果你想改变你添加的[image setRect:(CGRectMake(orginPosition.x, orginPosition.y, size.width, size.height))];的图像位置,它会在一段时间内改变例如CGRects

完成:是一个块,但不是必需的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17762574

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档