我正在从相册中挑选一张照片,但是我希望能够使用它执行以下操作:
将顶部和底部的 alpha 值(假设顶部 20 个像素和底部 20 个像素)更改为 0.5
然后只复制中间未更改的部分并将其分配给另一个 UIImageView
我有这个代码:
@synthesize imageView, croppedImageView, choosePhotoBtn, takePhotoBtn;
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == choosePhotoBtn) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:picker animated:YES];
}
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
[picker release];
imageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
/* then here I want to change the alpha value of the top and bottom parts */
/* then copy the unchanged part then assign it to the image value of croppedImageView */
}