-(void)viewWillAppear:(BOOL)animated{
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(EnterBackground:)
name:UIApplicationWillResignActiveNotification
object:nil];
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(DidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
}
- (void)EnterBackground:(NSNotification*)notification{
NSLog(@"Enter in background");
[self.movieFile endProcessing];
[self.filter removeAllTargets];
[self.movieFile removeAllTargets];
}
- (void)DidBecomeActive:(NSNotification*)notification{
[_movieFile startProcessing];
}
不要忘了在viewWillDisappear
刪除觀察員