2013-10-11 2 views

ответ

0

Добавить наблюдателя для UIDocumentStateChangedNotification в ваш viewDidLoad.

[[NSNotificationCenter defaultCenter] 
     addObserver:self 
     selector:@selector(itemHasChanged:) 
     name:UIDocumentStateChangedNotification 
     object:nil]; 

Если documentState измененного объекта устанавливается в UIDocumentStateSavingError, то он был удален.

-(void) itemHasChanged:(id)sender { 
    UIDocument *itemDoc = [sender object]; 

    if ([itemDoc documentState] == UIDocumentStateSavingError) { 
     // your code to handle a deleted document goes here 
     // in my case I remove that object from my array of current objects. 
    } 
} 
Смежные вопросы