Skip to content

Commit

Permalink
Removed pre iOS 7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kcharwood committed Mar 16, 2015
1 parent 550ceac commit c367d3f
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 224 deletions.
39 changes: 15 additions & 24 deletions KitchenSink/ExampleFiles/MMAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,4 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif


static BOOL OSVersionIsAtLeastiOS7() {
return (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1);
}
#endif
22 changes: 6 additions & 16 deletions KitchenSink/ExampleFiles/MMExampleCenterTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
37 changes: 7 additions & 30 deletions KitchenSink/ExampleFiles/MMExampleSideDrawerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,18 @@ - (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];
[self.view addSubview:self.tableView];
[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];
Expand Down Expand Up @@ -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{
Expand Down
12 changes: 5 additions & 7 deletions KitchenSink/ExampleFiles/MMExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
114 changes: 19 additions & 95 deletions KitchenSink/ExampleFiles/MMSideDrawerSectionHeaderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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:)]){
Expand All @@ -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];
Expand All @@ -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
20 changes: 4 additions & 16 deletions KitchenSink/ExampleFiles/MMSideDrawerTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
}
Expand Down
7 changes: 1 addition & 6 deletions KitchenSink/ExampleFiles/MMTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions MMDrawerController.podspec
Original file line number Diff line number Diff line change
@@ -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" => "[email protected]" }
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" ]
Expand Down
Loading

0 comments on commit c367d3f

Please sign in to comment.