【发布时间】:2013-08-05 08:48:14
【问题描述】:
我在cocos2D 中开发我的应用程序。
我使用了自定义UIView,它有2个UITextField和1个UITextView,还具有获取照片的功能。
在我的应用程序中,我使用UIImagePickerController 从相机/库中获取图像。所有功能都可以正常工作,但是当我从相机/库中选择照片然后关闭我的imagePicker 之后,我无法再次在UITextField 中输入文本。
我也看这个Question,关注他们。
我的相关代码是:
#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];
}
当我从库/相机中选择照片时出现问题。其他明智的键盘工作正常。
【问题讨论】:
-
可能b你的键盘被一个窗口重叠了..尝试使用UIWindow的背景颜色属性进行调试
-
我。使用 inputaccessoryview 时遇到同样的问题
标签: iphone ios objective-c cocos2d-iphone