我在cocos2D
.
我使用UIView
了具有 2UITextField
和 1的自定义,UITextView
并且还具有获取照片的功能。
在我的应用程序中,我用来UIImagePickerController
从相机/库中获取图像。所有功能都可以正常工作,但是当我从相机/库中选择照片然后关闭我imagePicker
之后,我无法再次在UITextField
.
我也看这个问题,并关注他们。
我的相关代码是:
#pragma Mark -
#pragma Mark - ActionSheet Delegate Methods
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIImagePickerController *imgPicker=[[UIImagePickerController alloc] init];
imgPicker.delegate=self;
imgPicker.wantsFullScreenLayout = YES;
imgPicker.allowsEditing=YES;
if(buttonIndex == 0)
{
isVideoTakenFromCamera = YES;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
else
imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
else if (buttonIndex==1)
{
isVideoTakenFromCamera = NO;
imgPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[[XPSModal sharedInstance] hideWindow]; // it is my custom UIView.
[[CCDirector sharedDirector] presentViewController:imgPicker animated:YES completion:nil];
// [[[[UIApplication sharedApplication] delegate] window] makeKeyWindow]; i alsos put here this code but it is not works for me.
}
#pragma mark -
#pragma mark - UIImagePickerController Delegate Method
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *img = [info objectForKey:UIImagePickerControllerEditedImage];
img = [self resizeImage:img];
[self.btnTakePhoto setImage:img forState:UIControlStateNormal];
[[CCDirector sharedDirector] dismissViewControllerAnimated:YES completion:nil];
[[XPSModal sharedInstance] showWindow]; // it is my custom UIView.
[[[[UIApplication sharedApplication] delegate] window] makeKeyWindow];
}
当我从库/相机中选择照片时会出现问题。其他明智的键盘工作正常。