i'm trying to add a "save before quit" alert on my app to avoid data loss if the user want to go back without saving on the previous view. I know there's a lot of method, but why this doesn't seems to work?
1) declare this two variables:
@property (nonatomic, assign) BOOL isChanged;
2)
@property (nonatomic, assign) NSString *modifiedText;
3) set to false "isChanged" at the init
4)
(void)textFieldDidBeginEditing:(UITextField *)textField {
self.modifiedText = textField.text;
5)
- (void)textFieldDidEndEditing:(UITextField *)textField {
if(![self.modifiedText isEqualToString:textField.text]){
self.isChanged = YES;
}
else{
self.isChanged = NO;
}
But i've a exc_bad_access on modified text on 5. Why?