Iphone UIImagePickerController和按键

Iphone UIImagePickerController和按键,iphone,uiimagepickercontroller,Iphone,Uiimagepickercontroller,我创建了UIImagePickerController的一个简单子类,如下所示: @interface CustomImagePicker : UIImagePickerController <UITextViewDelegate> { } -(void) viewDidAppear:(BOOL)animated{ // make sure to call the same method on the super class!!! // [super vie

我创建了UIImagePickerController的一个简单子类,如下所示:

@interface CustomImagePicker : UIImagePickerController <UITextViewDelegate> {
}

-(void) viewDidAppear:(BOOL)animated{
    // make sure to call the same method on the super class!!!
    //
    [super viewDidAppear:animated];

    UITextView *textView = [[[UITextView alloc] init] autorelease];
    [self.view addSubview:textView];

    [textView becomeFirstResponder];
    [textView setDelegate:self];
    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(keyPressed:) name: UITextViewTextDidChangeNotification object: nil];

}

- (void)textViewDidChange:(UITextView *)textView{
    NSLog(@"Picture Taken 2");

    [self takePicture];
}

-(void) keyPressed: (NSNotification*) notification
{
    NSLog(@"Picture Taken 1");
    [self takePicture];
}
按键或文本视图都没有被调用

有人有这方面的经验吗


提前谢谢

我认为它应该有效。我需要一些详细的信息

另一种方法是尝试使用
UITextViewDelegate

UITextView *textView = [[[UITextView alloc] init] autorelease];
[self.view addSubview:textView];

[textView becomeFirstResponder];
[textView setDelegate:self];
实施,<代码>-(无效)textViewDidChange:(UITextView*)textView方法添加到类中


仅供参考:

我认为不允许您对UIImagePickerController进行子类化

文档位于-- 指定
“重要提示:UIImagePickerController类仅支持纵向模式。该类按原样使用,不支持子类化。”

好主意,请注意,但在我的代码中它不起作用。我已使用实际代码更新了查询,是否遗漏了任何内容?请尝试使用-viewDidAppear而不是-viewWillAppear。无更改。我想它可能有机会初始化。您确定您的
-(void)viewDidDisplay:(BOOL)animated
-(void)viewWillDisplay:(BOOL)animated
方法工作正常吗。尝试在这些方法中添加断点,并查看调试器是否在这些断点上停止。如果它们根本不起作用,那么模态视图控制器的表示就有问题。尝试在第一个索引处从窗口中的其他viewController出口显示。我知道这很奇怪,但苹果有一些bug。
UITextView *textView = [[[UITextView alloc] init] autorelease];
[self.view addSubview:textView];

[textView becomeFirstResponder];
[textView setDelegate:self];