我想NSLog
當我的UITextView完成編輯時。UITextView沒有結束編輯
我已經試過
- (BOOL)textViewShouldEndEditing:(UITextView *)textView
和
- (void)textViewDidEndEditing:(UITextView *)textView
既不工作。
修復:
myTextView.delegate = self;
我想NSLog
當我的UITextView完成編輯時。UITextView沒有結束編輯
我已經試過
- (BOOL)textViewShouldEndEditing:(UITextView *)textView
和
- (void)textViewDidEndEditing:(UITextView *)textView
既不工作。
修復:
myTextView.delegate = self;
你設置你的TextView的代表?
的解決辦法:在.h文件中
組代表這樣的:
#import <UIKit/UIKit.h>
@interface TextViewController : UIViewController <UITextViewDelegate>
{
UITextView *textView;
}
@property (nonatomic, retain) UITextView *textView;
@end
如果您正在使用的UITextField,而不是一定要使用UITextFieldDelegate而不是UITextViewDelegate。而這種方法反而改變了我的問題。
- (void)textFieldDidEndEditing:(UITextField *)textField
我會接受你的答案,當它讓我。感謝您的快速回復。 – atomikpanda
並且不要忘記.h文件中的代理設置 –
如何在.h文件中設置它? – atomikpanda