|
@@ -1730,6 +1730,9 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
#pragma mark Delegate methods
|
|
|
|
|
|
- (void)tabDidInsert:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *contents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
|
NSInteger modelIndex = [[userInfo valueForKey:CTTabIndexUserInfoKey] intValue];
|
|
@@ -1804,6 +1807,10 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
}
|
|
|
|
|
|
- (void)tabDidSelect:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *newContents = [userInfo valueForKey:CTTabNewContentsUserInfoKey];
|
|
|
CTTabContents *oldContents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
@@ -1870,6 +1877,10 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
}
|
|
|
|
|
|
- (void)tabDidChange:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *contents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
|
NSInteger modelIndex = [[userInfo valueForKey:CTTabIndexUserInfoKey] intValue];
|
|
@@ -1905,6 +1916,10 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
}
|
|
|
|
|
|
- (void)tabDidMove:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *contents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
|
NSInteger modelFrom = [[userInfo valueForKey:CTTabIndexUserInfoKey] intValue];
|
|
@@ -1937,6 +1952,9 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
}
|
|
|
|
|
|
- (void)tabDidChangeMiniState:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *contents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
|
NSInteger modelIndex = [[userInfo valueForKey:CTTabIndexUserInfoKey] intValue];
|
|
@@ -1962,6 +1980,10 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
}
|
|
|
|
|
|
- (void)tabDidDetach:(NSNotification *)notification {
|
|
|
+ if (![self _tabStripModelIsValid:notification.object]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
NSDictionary *userInfo = notification.userInfo;
|
|
|
CTTabContents *contents = [userInfo valueForKey:CTTabContentsUserInfoKey];
|
|
|
NSInteger modelIndex = [[userInfo valueForKey:CTTabIndexUserInfoKey] intValue];
|
|
@@ -1989,6 +2011,15 @@ const NSTimeInterval kAnimationDuration = 0.125;
|
|
|
object:self];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - Private Methods
|
|
|
+
|
|
|
+- (BOOL)_tabStripModelIsValid:(CTTabStripModel *)obj {
|
|
|
+ if (self->tabStripModel_ == nil || ![self->tabStripModel_ isEqualTo:obj]) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation CTTabStripController (KMExtensions)
|