diff --git a/Src/MLScrollView.h b/Src/MLScrollView.h deleted file mode 100644 index b882a48..0000000 --- a/Src/MLScrollView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// MLScrollView.h -// MultiLayerNavigation -// -// Created by Feather Chan on 13-4-12. -// Copyright (c) 2013年 Feather Chan. All rights reserved. -// - -#import - -@interface MLScrollView : UIScrollView - -@end diff --git a/Src/MLScrollView.m b/Src/MLScrollView.m deleted file mode 100644 index 453b7e4..0000000 --- a/Src/MLScrollView.m +++ /dev/null @@ -1,112 +0,0 @@ -// -// MLScrollView.m -// MultiLayerNavigation -// -// Created by Feather Chan on 13-4-12. -// Copyright (c) 2013年 Feather Chan. All rights reserved. -// - -#import "MLScrollView.h" -#import "MLNavigationController.h" - - -@interface UIView (FindUIViewController) - -- (UIViewController *)viewController; - -@end - - -@implementation MLScrollView - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - } - return self; -} - -- (MLNavigationController *)firstAvailableNavigationController -{ - if ([[self viewController].navigationController isKindOfClass:[MLNavigationController class]]) - { - return (MLNavigationController *)[self viewController].navigationController; - } - - return nil; -} - -#pragma mark - UIResponse Subclassing - - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - - //send the event to MLNavigationController - [self.firstAvailableNavigationController touchesBegan:touches withEvent:event]; - - self.scrollEnabled = NO; -} - - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesEnded:touches withEvent:event]; - - self.scrollEnabled = YES; - -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesCancelled:touches withEvent:event]; - - self.scrollEnabled = YES; -} - -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect -{ - // Drawing code -} -*/ - -@end - - - -@implementation UIView (FindUIViewController) - -// Get to UIViewController from UIView on iPhone? -// http://stackoverflow.com/a/3732812/1104158 - - -- (UIViewController *)viewController { - /// Finds the view's view controller. - - // Traverse responder chain. Return first found view controller, which will be the view's view controller. - UIResponder *responder = self; - while ((responder = [responder nextResponder])) - if ([responder isKindOfClass: [UIViewController class]]) - return (UIViewController *)responder; - - // If the view controller isn't found, return nil. - return nil; -} -@end - diff --git a/Src/MLTableView.h b/Src/MLTableView.h deleted file mode 100644 index 605258c..0000000 --- a/Src/MLTableView.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// MLTableView.h -// MultiLayerNavigation -// -// Created by Feather Chan on 13-4-17. -// Copyright (c) 2013年 Feather Chan. All rights reserved. -// - -#import - -@interface MLTableView : UITableView - -@end diff --git a/Src/MLTableView.m b/Src/MLTableView.m deleted file mode 100644 index e6f5001..0000000 --- a/Src/MLTableView.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// MLTableView.m -// MultiLayerNavigation -// -// Created by Feather Chan on 13-4-17. -// Copyright (c) 2013年 Feather Chan. All rights reserved. -// - -#import "MLTableView.h" -#import "MLNavigationController.h" - -@implementation MLTableView - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - } - return self; -} - -#pragma mark - UIResponse Subclassing - - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - - //send the event to MLNavigationController - [self.firstAvailableNavigationController touchesBegan:touches withEvent:event]; - - self.scrollEnabled = NO; - - -} - - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesMoved:touches withEvent:event]; - - self.allowsSelection = NO; - -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesEnded:touches withEvent:event]; - - self.scrollEnabled = YES; - self.allowsSelection = YES; - [self deselectRowAtIndexPath:[self indexPathForSelectedRow] animated:NO]; - -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - - [self.firstAvailableNavigationController touchesCancelled:touches withEvent:event]; - - self.scrollEnabled = YES; - self.allowsSelection = YES; - [self deselectRowAtIndexPath:[self indexPathForSelectedRow] animated:NO]; - -} - -/* -// Only override drawRect: if you perform custom drawing. -// An empty implementation adversely affects performance during animation. -- (void)drawRect:(CGRect)rect -{ - // Drawing code -} -*/ - -- (MLNavigationController *)firstAvailableNavigationController -{ - if ([[self viewController].navigationController isKindOfClass:[MLNavigationController class]]) - { - return (MLNavigationController *)[self viewController].navigationController; - } - - return nil; -} - -- (UIViewController *)viewController { - /// Finds the view's view controller. - - // Traverse responder chain. Return first found view controller, which will be the view's view controller. - UIResponder *responder = self; - while ((responder = [responder nextResponder])) - if ([responder isKindOfClass: [UIViewController class]]) - return (UIViewController *)responder; - - // If the view controller isn't found, return nil. - return nil; -} - -@end