ios - 图像的裁剪选项
<p><p>我想从相册中选择图片并用相机拍摄。它的代码运行良好,但我只需要选择部分图像意味着裁剪图像集我的 imageView。</p>
<pre><code>-(IBAction)chooseAlbum:(id)sender
{
imagePicker=[init];
imagePicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate=self;
;
}
-(IBAction)takePicture:(id)sender
{
imagePicker=[init];
imagePicker.sourceType=UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
;
}
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info
{
profileImageView.image=;
;
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>开启编辑模式</p>
<pre><code>imagePicker.allowsEditing = YES;
</code></pre>
<p>然后在您的委托(delegate)方法中使用 <code>UIImagePickerControllerEditedImage</code> 键</p>
<pre><code>-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info {
profileImageView.image=;
;
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 图像的裁剪选项,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32835289/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32835289/
</a>
</p>
页:
[1]