私はクラス Y で UITextView を使用しており、サブビューとして X にクラス Y を追加しました。ここで、編集が UIKeyboardDidShowNotification の通知で送信される UItextview で開始すると、通知を送信するときに 2 つのタスクを実行する必要があります。 1. ビュー全体を P 単位だけ上にシフトします。
これが私がやっているコードです...
注:- 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 .....エラーは、デリゲートの使用方法または通知に関連している可能性があるという直感があります。誰でも助けてもらえますか....私は長い間この問題に取り組んでいます