Remove gesture recognizer from PhoneMainView when dealloc InCallViewController

This commit is contained in:
Yann Diorcet 2012-08-16 15:47:06 +02:00
parent 27ad4bbee8
commit 22e828cace
4 changed files with 30 additions and 9 deletions

View file

@ -208,10 +208,6 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
forState:(UIControlStateDisabled | UIControlStateSelected)];
}
- (void)viewDidUnload {
[super viewDidUnload];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if ([[UIDevice currentDevice].systemVersion doubleValue] < 5.0) {

View file

@ -40,6 +40,7 @@
UIView* testVideoView;
#endif
UICamSwitch* videoCameraSwitch;
UITapGestureRecognizer* singleFingerTap;
UIActivityIndicatorView* videoWaitingForFirstImage;

View file

@ -53,7 +53,12 @@ const NSInteger SECURE_BUTTON_TAG=5;
#pragma mark - Lifecycle Functions
- (id)init {
return [super initWithNibName:@"InCallViewController" bundle:[NSBundle mainBundle]];
self = [super initWithNibName:@"InCallViewController" bundle:[NSBundle mainBundle]];
if(self != nil) {
self->singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)];
self->videoZoomHandler = [[VideoZoomHandler alloc] init];
}
return self;
}
- (void)dealloc {
@ -72,6 +77,9 @@ const NSInteger SECURE_BUTTON_TAG=5;
[videoZoomHandler release];
[[PhoneMainView instance].view removeGestureRecognizer:singleFingerTap];
[singleFingerTap release];
// Remove all observer
[[NSNotificationCenter defaultCenter] removeObserver:self];
@ -171,13 +179,10 @@ static UICompositeViewDescription *compositeDescription = nil;
linphone_core_set_native_video_window_id([LinphoneManager getLc],(unsigned long)videoView);
linphone_core_set_native_preview_window_id([LinphoneManager getLc],(unsigned long)videoPreview);
UITapGestureRecognizer* singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showControls:)];
[singleFingerTap setNumberOfTapsRequired:1];
[singleFingerTap setCancelsTouchesInView: FALSE];
[[PhoneMainView instance].view addGestureRecognizer:singleFingerTap];
[singleFingerTap release];
videoZoomHandler = [[VideoZoomHandler alloc] init];
[videoZoomHandler setup:videoGroup];
videoGroup.alpha = 0;
@ -186,6 +191,10 @@ static UICompositeViewDescription *compositeDescription = nil;
removeTableBackground([callTableController view]);
}
- (void)viewDidUnload {
[super viewDidUnload];
[[PhoneMainView instance].view removeGestureRecognizer:singleFingerTap];
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];

View file

@ -244,6 +244,10 @@
return NO;
}
- (void)didReceiveMemoryWarning {
[self clearCache];
}
#pragma mark - Event Functions
@ -259,7 +263,18 @@
#pragma mark -
- (void)clearCache {
[viewControllerCache removeAllObjects];
for(NSString *key in [viewControllerCache allKeys]) {
UIViewController *vc = [viewControllerCache objectForKey:key];
if(vc != self.stateBarViewController &&
vc != self.tabBarViewController &&
vc != self.contentViewController) {
if ([[UIDevice currentDevice].systemVersion doubleValue] >= 5.0) {
[vc viewWillUnload];
}
[vc viewDidUnload];
}
[viewControllerCache removeObjectForKey:key];
}
}
- (UIInterfaceOrientation)currentOrientation {