diff --git a/KitchenSink/ExampleFiles/MMAppDelegate.m b/KitchenSink/ExampleFiles/MMAppDelegate.m index a5a4eb5c..4e66a53f 100644 --- a/KitchenSink/ExampleFiles/MMAppDelegate.m +++ b/KitchenSink/ExampleFiles/MMAppDelegate.m @@ -46,23 +46,15 @@ -(BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:( UINavigationController * navigationController = [[MMNavigationController alloc] initWithRootViewController:centerViewController]; [navigationController setRestorationIdentifier:@"MMExampleCenterNavigationControllerRestorationKey"]; - if(OSVersionIsAtLeastiOS7()){ - UINavigationController * rightSideNavController = [[MMNavigationController alloc] initWithRootViewController:rightSideDrawerViewController]; - [rightSideNavController setRestorationIdentifier:@"MMExampleRightNavigationControllerRestorationKey"]; - UINavigationController * leftSideNavController = [[MMNavigationController alloc] initWithRootViewController:leftSideDrawerViewController]; - [leftSideNavController setRestorationIdentifier:@"MMExampleLeftNavigationControllerRestorationKey"]; - self.drawerController = [[MMDrawerController alloc] - initWithCenterViewController:navigationController - leftDrawerViewController:leftSideNavController - rightDrawerViewController:rightSideNavController]; - [self.drawerController setShowsShadow:NO]; - } - else{ - self.drawerController = [[MMDrawerController alloc] - initWithCenterViewController:navigationController - leftDrawerViewController:leftSideDrawerViewController - rightDrawerViewController:rightSideDrawerViewController]; - } + UINavigationController * rightSideNavController = [[MMNavigationController alloc] initWithRootViewController:rightSideDrawerViewController]; + [rightSideNavController setRestorationIdentifier:@"MMExampleRightNavigationControllerRestorationKey"]; + UINavigationController * leftSideNavController = [[MMNavigationController alloc] initWithRootViewController:leftSideDrawerViewController]; + [leftSideNavController setRestorationIdentifier:@"MMExampleLeftNavigationControllerRestorationKey"]; + self.drawerController = [[MMDrawerController alloc] + initWithCenterViewController:navigationController + leftDrawerViewController:leftSideNavController + rightDrawerViewController:rightSideNavController]; + [self.drawerController setShowsShadow:NO]; [self.drawerController setRestorationIdentifier:@"MMDrawer"]; [self.drawerController setMaximumRightDrawerWidth:200.0]; [self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; @@ -78,13 +70,12 @@ -(BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:( } }]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - if(OSVersionIsAtLeastiOS7()){ - UIColor * tintColor = [UIColor colorWithRed:29.0/255.0 - green:173.0/255.0 - blue:234.0/255.0 - alpha:1.0]; - [self.window setTintColor:tintColor]; - } + + UIColor * tintColor = [UIColor colorWithRed:29.0/255.0 + green:173.0/255.0 + blue:234.0/255.0 + alpha:1.0]; + [self.window setTintColor:tintColor]; [self.window setRootViewController:self.drawerController]; return YES; diff --git a/KitchenSink/ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch b/KitchenSink/ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch index a5bafa3b..9582c102 100644 --- a/KitchenSink/ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch +++ b/KitchenSink/ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch @@ -11,9 +11,4 @@ #ifdef __OBJC__ #import #import -#endif - - -static BOOL OSVersionIsAtLeastiOS7() { - return (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1); -} \ No newline at end of file +#endif \ No newline at end of file diff --git a/KitchenSink/ExampleFiles/MMExampleCenterTableViewController.m b/KitchenSink/ExampleFiles/MMExampleCenterTableViewController.m index 287df679..8a52b793 100644 --- a/KitchenSink/ExampleFiles/MMExampleCenterTableViewController.m +++ b/KitchenSink/ExampleFiles/MMExampleCenterTableViewController.m @@ -76,22 +76,12 @@ - (void)viewDidLoad [self setupLeftMenuButton]; [self setupRightMenuButton]; - if(OSVersionIsAtLeastiOS7()){ - UIColor * barColor = [UIColor - colorWithRed:247.0/255.0 - green:249.0/255.0 - blue:250.0/255.0 - alpha:1.0]; - [self.navigationController.navigationBar setBarTintColor:barColor]; - } - else { - UIColor * barColor = [UIColor - colorWithRed:78.0/255.0 - green:156.0/255.0 - blue:206.0/255.0 - alpha:1.0]; - [self.navigationController.navigationBar setTintColor:barColor]; - } + UIColor * barColor = [UIColor + colorWithRed:247.0/255.0 + green:249.0/255.0 + blue:250.0/255.0 + alpha:1.0]; + [self.navigationController.navigationBar setBarTintColor:barColor]; MMLogoView * logo = [[MMLogoView alloc] initWithFrame:CGRectMake(0, 0, 29, 31)]; diff --git a/KitchenSink/ExampleFiles/MMExampleSideDrawerViewController.m b/KitchenSink/ExampleFiles/MMExampleSideDrawerViewController.m index 21c3e8ea..951b9f49 100644 --- a/KitchenSink/ExampleFiles/MMExampleSideDrawerViewController.m +++ b/KitchenSink/ExampleFiles/MMExampleSideDrawerViewController.m @@ -32,12 +32,7 @@ - (void)viewDidLoad { [super viewDidLoad]; - if(OSVersionIsAtLeastiOS7()){ - _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; - } - else { - _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; - } + _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped]; [self.tableView setDelegate:self]; [self.tableView setDataSource:self]; @@ -45,18 +40,10 @@ - (void)viewDidLoad [self.tableView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; UIColor * tableViewBackgroundColor; - if(OSVersionIsAtLeastiOS7()){ - tableViewBackgroundColor = [UIColor colorWithRed:110.0/255.0 - green:113.0/255.0 - blue:115.0/255.0 - alpha:1.0]; - } - else { - tableViewBackgroundColor = [UIColor colorWithRed:77.0/255.0 - green:79.0/255.0 - blue:80.0/255.0 - alpha:1.0]; - } + tableViewBackgroundColor = [UIColor colorWithRed:110.0/255.0 + green:113.0/255.0 + blue:115.0/255.0 + alpha:1.0]; [self.tableView setBackgroundColor:tableViewBackgroundColor]; [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; @@ -322,24 +309,14 @@ -(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSIntege -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ MMSideDrawerSectionHeaderView * headerView; - if(OSVersionIsAtLeastiOS7()){ - headerView = [[MMSideDrawerSectionHeaderView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), 56.0)]; - } - else { - headerView = [[MMSideDrawerSectionHeaderView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), 23.0)]; - } + headerView = [[MMSideDrawerSectionHeaderView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(tableView.bounds), 56.0)]; [headerView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; [headerView setTitle:[tableView.dataSource tableView:tableView titleForHeaderInSection:section]]; return headerView; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ - if(OSVersionIsAtLeastiOS7()){ - return 56.0; - } - else { - return 23.0; - } + return 56.0; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ diff --git a/KitchenSink/ExampleFiles/MMExampleViewController.m b/KitchenSink/ExampleFiles/MMExampleViewController.m index 3ae10312..d6c67664 100644 --- a/KitchenSink/ExampleFiles/MMExampleViewController.m +++ b/KitchenSink/ExampleFiles/MMExampleViewController.m @@ -38,13 +38,11 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil - (void)viewDidLoad { [super viewDidLoad]; - if(OSVersionIsAtLeastiOS7()){ - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(contentSizeDidChangeNotification:) - name:UIContentSizeCategoryDidChangeNotification - object:nil]; - } + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(contentSizeDidChangeNotification:) + name:UIContentSizeCategoryDidChangeNotification + object:nil]; } - (void)dealloc{ diff --git a/KitchenSink/ExampleFiles/MMSideDrawerSectionHeaderView.m b/KitchenSink/ExampleFiles/MMSideDrawerSectionHeaderView.m index 2da6eb67..3d34f966 100644 --- a/KitchenSink/ExampleFiles/MMSideDrawerSectionHeaderView.m +++ b/KitchenSink/ExampleFiles/MMSideDrawerSectionHeaderView.m @@ -33,25 +33,12 @@ - (id)initWithFrame:(CGRect)frame if (self) { // Initialization code - if(OSVersionIsAtLeastiOS7()){ - [self setBackgroundColor:[UIColor colorWithRed:110./255.0 - green:113.0/255.0 - blue:115.0/255.0 - alpha:1.0]]; - } - else { - [self setBackgroundColor:[UIColor colorWithRed:77.0/255.0 - green:79.0/255.0 - blue:80.0/255.0 - alpha:1.0]]; - } + [self setBackgroundColor:[UIColor colorWithRed:110./255.0 + green:113.0/255.0 + blue:115.0/255.0 + alpha:1.0]]; - if(OSVersionIsAtLeastiOS7()){ - _label = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.bounds)-28,CGRectGetWidth(self.bounds)-30, 22)]; - } - else { - _label = [[UILabel alloc] initWithFrame:CGRectInset(self.bounds, 10.0, 2.0)]; - } + _label = [[UILabel alloc] initWithFrame:CGRectMake(15, CGRectGetMaxY(self.bounds)-28,CGRectGetWidth(self.bounds)-30, 22)]; if([[UIFont class] respondsToSelector:@selector(preferredFontForTextStyle:)]){ @@ -66,10 +53,6 @@ - (id)initWithFrame:(CGRect)frame green:206.0/255.0 blue:209.0/255.0 alpha:1.0]]; - if(OSVersionIsAtLeastiOS7() == NO){ - [self.label setShadowOffset:CGSizeMake(0, 1)]; - [self.label setShadowColor:[[UIColor blackColor] colorWithAlphaComponent:.5]]; - } [self.label setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin]; [self addSubview:self.label]; [self setClipsToBounds:NO]; @@ -84,79 +67,20 @@ -(void)setTitle:(NSString *)title{ -(void)drawRect:(CGRect)rect{ //// General Declarations - if(OSVersionIsAtLeastiOS7()== NO){ - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = UIGraphicsGetCurrentContext(); - - //// Color Declarations - UIColor* color = [UIColor colorWithRed: 0.373 green: 0.388 blue: 0.404 alpha: 1]; - UIColor* color2 = [UIColor colorWithRed: 0.216 green: 0.231 blue: 0.243 alpha: 1]; - UIColor* color3 = [UIColor colorWithRed: 0.451 green: 0.463 blue: 0.475 alpha: 1]; - UIColor* color4 = [UIColor colorWithRed: 0.184 green: 0.2 blue: 0.212 alpha: 1]; - UIColor* fillColor2 = [UIColor colorWithRed: 0.373 green: 0.388 blue: 0.404 alpha: 0]; - - //// Gradient Declarations - NSArray* gradient2Colors = [NSArray arrayWithObjects: - (id)color.CGColor, - (id)fillColor2.CGColor, nil]; - CGFloat gradient2Locations[] = {0, 1}; - CGGradientRef gradient2 = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)gradient2Colors, gradient2Locations); - - //// Frames - CGRect frame = CGRectMake(0, -1, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds)+1); - - - //// Fill Drawing - CGRect fillRect = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), CGRectGetWidth(frame), CGRectGetHeight(frame) - 1); - UIBezierPath* fillPath = [UIBezierPath bezierPathWithRect: fillRect]; - CGContextSaveGState(context); - [fillPath addClip]; - CGContextDrawLinearGradient(context, gradient2, - CGPointMake(CGRectGetMidX(fillRect), CGRectGetMinY(fillRect)), - CGPointMake(CGRectGetMidX(fillRect), CGRectGetMaxY(fillRect)), - 0); - CGContextRestoreGState(context); - - - //// TopStroke Drawing - UIBezierPath* topStrokePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame), CGRectGetWidth(frame), 1)]; - [color4 setFill]; - [topStrokePath fill]; - - - //// Highlight Drawing - UIBezierPath* highlightPath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame) + 1, CGRectGetWidth(frame), 1)]; - [color3 setFill]; - [highlightPath fill]; - - - //// BottomStroke Drawing - UIBezierPath* bottomStrokePath = [UIBezierPath bezierPathWithRect: CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(frame) + CGRectGetHeight(frame) - 1, CGRectGetWidth(frame), 1)]; - [color2 setFill]; - [bottomStrokePath fill]; - - - //// Cleanup - CGGradientRelease(gradient2); - CGColorSpaceRelease(colorSpace); - - } - else { - CGContextRef context = UIGraphicsGetCurrentContext(); - UIColor * lineColor = [UIColor colorWithRed:94.0/255.0 - green:97.0/255.0 - blue:99.0/255.0 - alpha:1.0]; - CGContextSetStrokeColorWithColor(context, lineColor.CGColor); - - CGContextSetLineWidth(context, 1.0); - - CGContextMoveToPoint(context, CGRectGetMinX(self.bounds), CGRectGetMaxY(self.bounds)-.5); //start at this point - - CGContextAddLineToPoint(context, CGRectGetMaxX(self.bounds), CGRectGetMaxY(self.bounds)-.5); //draw to this point - - CGContextStrokePath(context); - } + CGContextRef context = UIGraphicsGetCurrentContext(); + UIColor * lineColor = [UIColor colorWithRed:94.0/255.0 + green:97.0/255.0 + blue:99.0/255.0 + alpha:1.0]; + CGContextSetStrokeColorWithColor(context, lineColor.CGColor); + + CGContextSetLineWidth(context, 1.0); + + CGContextMoveToPoint(context, CGRectGetMinX(self.bounds), CGRectGetMaxY(self.bounds)-.5); //start at this point + + CGContextAddLineToPoint(context, CGRectGetMaxX(self.bounds), CGRectGetMaxY(self.bounds)-.5); //draw to this point + + CGContextStrokePath(context); } @end diff --git a/KitchenSink/ExampleFiles/MMSideDrawerTableViewCell.m b/KitchenSink/ExampleFiles/MMSideDrawerTableViewCell.m index 845fb445..ac231f51 100644 --- a/KitchenSink/ExampleFiles/MMSideDrawerTableViewCell.m +++ b/KitchenSink/ExampleFiles/MMSideDrawerTableViewCell.m @@ -32,18 +32,10 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus UIView * backgroundView = [[UIView alloc] initWithFrame:self.bounds]; [backgroundView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth]; UIColor * backgroundColor; - if(OSVersionIsAtLeastiOS7()){ - backgroundColor = [UIColor colorWithRed:122.0/255.0 - green:126.0/255.0 - blue:128.0/255.0 - alpha:1.0]; - } - else { - backgroundColor = [UIColor colorWithRed:77.0/255.0 - green:79.0/255.0 - blue:80.0/255.0 - alpha:1.0]; - } + backgroundColor = [UIColor colorWithRed:122.0/255.0 + green:126.0/255.0 + blue:128.0/255.0 + alpha:1.0]; [backgroundView setBackgroundColor:backgroundColor]; [self setBackgroundView:backgroundView]; @@ -54,10 +46,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus green:236.0/255.0 blue:242.0/255.0 alpha:1.0]]; - if(OSVersionIsAtLeastiOS7()== NO){ - [self.textLabel setShadowColor:[[UIColor blackColor] colorWithAlphaComponent:.5]]; - [self.textLabel setShadowOffset:CGSizeMake(0, 1)]; - } } return self; } diff --git a/KitchenSink/ExampleFiles/MMTableViewCell.m b/KitchenSink/ExampleFiles/MMTableViewCell.m index 8ebbfa66..e6e758e1 100644 --- a/KitchenSink/ExampleFiles/MMTableViewCell.m +++ b/KitchenSink/ExampleFiles/MMTableViewCell.m @@ -41,12 +41,7 @@ -(void)drawRect:(CGRect)rect{ //// Color Declarations UIColor* shadow; - if(OSVersionIsAtLeastiOS7()){ - shadow = [UIColor clearColor]; - } - else { - shadow = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 0.46]; - } + shadow = [UIColor clearColor]; UIColor* chevronColor = self.color; //// Shadow Declarations diff --git a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj index ac90844c..3f848a84 100644 --- a/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj +++ b/KitchenSink/MMDrawerControllerKitchenSink.xcodeproj/project.pbxproj @@ -407,7 +407,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch"; INFOPLIST_FILE = "ExampleFiles/MMDrawerControllerKitchenSink-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = MMDrawerControllerKitchenSink; WARNING_CFLAGS = "-Wdocumentation"; WRAPPER_EXTENSION = app; @@ -420,7 +420,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "ExampleFiles/MMDrawerControllerKitchenSink-Prefix.pch"; INFOPLIST_FILE = "ExampleFiles/MMDrawerControllerKitchenSink-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = MMDrawerControllerKitchenSink; WARNING_CFLAGS = "-Wdocumentation"; WRAPPER_EXTENSION = app; diff --git a/MMDrawerController.podspec b/MMDrawerController.podspec index 89206029..53ea43c8 100644 --- a/MMDrawerController.podspec +++ b/MMDrawerController.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = "MMDrawerController" - s.version = "0.5.7" + s.version = "0.6.0" s.summary = "A lightweight, easy-to-use side drawer navigation controller." s.homepage = "https://github.com/mutualmobile/MMDrawerController" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Kevin Harwood" => "kevin.harwood@mutualmobile.com" } - s.source = { :git => "https://github.com/mutualmobile/MMDrawerController.git", :tag => "0.5.7" } - s.platform = :ios, '5.0' + s.source = { :git => "https://github.com/mutualmobile/MMDrawerController.git", :tag => "0.6.0" } + s.platform = :ios, '7.0' s.requires_arc = true s.screenshots = [ "http://mutualmobile.github.io/MMDrawerController/ExampleImages/example1.png", "http://mutualmobile.github.io/MMDrawerController/ExampleImages/example2.png" ] diff --git a/MMDrawerController/MMDrawerController.m b/MMDrawerController/MMDrawerController.m index 996994d7..bf784d3b 100644 --- a/MMDrawerController/MMDrawerController.m +++ b/MMDrawerController/MMDrawerController.m @@ -919,26 +919,19 @@ -(void)setMaximumRightDrawerWidth:(CGFloat)maximumRightDrawerWidth{ } -(void)setShowsStatusBarBackgroundView:(BOOL)showsDummyStatusBar{ - NSArray *sysVersion = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; - float majorVersion = [[sysVersion objectAtIndex:0] floatValue]; - if (majorVersion >= 7){ - if(showsDummyStatusBar!=_showsStatusBarBackgroundView){ - _showsStatusBarBackgroundView = showsDummyStatusBar; - CGRect frame = self.childControllerContainerView.frame; - if(_showsStatusBarBackgroundView){ - frame.origin.y = 20; - frame.size.height = CGRectGetHeight(self.view.bounds)-20; - } - else { - frame.origin.y = 0; - frame.size.height = CGRectGetHeight(self.view.bounds); - } - [self.childControllerContainerView setFrame:frame]; - [self.dummyStatusBarView setHidden:!showsDummyStatusBar]; + if(showsDummyStatusBar!=_showsStatusBarBackgroundView){ + _showsStatusBarBackgroundView = showsDummyStatusBar; + CGRect frame = self.childControllerContainerView.frame; + if(_showsStatusBarBackgroundView){ + frame.origin.y = 20; + frame.size.height = CGRectGetHeight(self.view.bounds)-20; } - } - else { - _showsStatusBarBackgroundView = NO; + else { + frame.origin.y = 0; + frame.size.height = CGRectGetHeight(self.view.bounds); + } + [self.childControllerContainerView setFrame:frame]; + [self.dummyStatusBarView setHidden:!showsDummyStatusBar]; } }