0

我在 Y 类中使用 UITextView,并且我在 X 中添加了 Y 类作为子视图。现在,当在 UITextview 中开始编辑时,在 UIKeyboardDidShowNotification 上发送通知时,当它发送通知时需要完成两个任务 1. 将整个视图向上移动 P 个单位 2. 键盘动画自行发生

这是我正在做的代码......

注意:- NewTagDesc 是一个 UIView

 @protocol TagDescDelegate;

@interface NewTagDesc : UIView <UITextViewDelegate>
{
    __unsafe_unretained id <TagDescDelegate> delegate;
}

@property (nonatomic, unsafe_unretained) id <TagDescDelegate> delegate;


//it crashes here, if you touch desc too freq. says its calling this method and this class is deallocated
-(void) noticeShowKeyboard:(NSNotification *)inNotification {
    if ([delegate respondsToSelector:@selector(editingDescStarted:)]) {
        [delegate editingDescStarted:self];
    }
    keyboardVisible = YES;
}

-(void) noticeHideKeyboard:(NSNotification *)inNotification {
    if ([delegate respondsToSelector:@selector(editingDescEnded:)]) {
        [delegate editingDescEnded:self];
    }
    keyboardVisible = NO;
}

现在当通知被触发时,我的应用程序崩溃了。说它已被分配并调用noticeShowKeyboard...:O .....我直觉错误可能与使用委托的方式或通知有关。任何人都可以帮忙....我很长时间以来一直在研究这个问题

4

0 回答 0