2010-11-07 3 views

Répondre

14

Mettre en oeuvre la méthode UITextViewDelegate appelé textViewDidBeginEditing:, et à l'intérieur de celui-ci, définissez la propriété text à un objet NSString vide:

- (void) textViewDidBeginEditing:(UITextView *) textView { 
    [textView setText:@""]; 
    //other awesome stuff here... 
} 
+3

+1 pour fournir l'espace pour mettre "trucs super". –

+0

ne fonctionne pas pour moi, délégué délégué, a ajouté cette méthode, mais il n'est pas appelé pour une raison inconnue. –

0

ci-dessus ne fonctionne pas pour moi, a dû utiliser les notifications:

add notification dans viewWillAppear:

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textViewDidBeginEditing:) name:UITextViewTextDidBeginEditingNotification object:nil]; 

méthode pour effacer le courant tex t vue

-(void)textViewDidBeginEditing:(NSNotification *)notif{ 
UITextView *textView=notif.object; 
[email protected]""; 

}

supprimer notification viewWillDisappear:

[[NSNotificationCenter defaultCenter] removeObserver:self name:UITextViewTextDidBeginEditingNotification object:nil]; 

aide quelqu'un espère que ce

Questions connexes