Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Classes/MGSplitCornersView.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#import "MGSplitCornersView.h"

CGFloat deg2Rad(CGFloat degrees);
CGFloat rad2Deg(CGFloat radians);

@implementation MGSplitCornersView

Expand Down Expand Up @@ -43,17 +45,17 @@ - (void)dealloc
#pragma mark Geometry helpers


double deg2Rad(double degrees)
CGFloat deg2Rad(CGFloat degrees)
{
// Converts degrees to radians.
return degrees * (M_PI / 180.0);
return (CGFloat) (degrees * (M_PI / 180.0));
}


double rad2Deg(double radians)
CGFloat rad2Deg(CGFloat radians)
{
// Converts radians to degrees.
return radians * (180 / M_PI);
return (CGFloat) (radians * (180 / M_PI));
}


Expand Down
14 changes: 7 additions & 7 deletions Classes/MGSplitDividerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ - (void)drawRect:(CGRect)rect
CGRect bounds = self.bounds;
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
CGFloat locations[2] = {0, 1};
CGFloat components[8] = { 0.988, 0.988, 0.988, 1.0, // light
0.875, 0.875, 0.875, 1.0 };// dark
CGFloat components[8] = { 0.988f, 0.988f, 0.988f, 1.0f, // light
0.875f, 0.875f, 0.875f, 1.0f };// dark
CGGradientRef gradient = CGGradientCreateWithColorComponents (rgb, components, locations, 2);
CGContextRef context = UIGraphicsGetCurrentContext();
CGPoint start, end;
Expand All @@ -69,7 +69,7 @@ - (void)drawRect:(CGRect)rect

// Draw borders.
float borderThickness = 1.0;
[[UIColor colorWithWhite:0.7 alpha:1.0] set];
[[UIColor colorWithWhite:0.7f alpha:1.0f] set];
CGRect borderRect = bounds;
if (splitViewController.vertical) {
borderRect.size.width = borderThickness;
Expand Down Expand Up @@ -103,12 +103,12 @@ - (void)drawGripThumbInRect:(CGRect)rect

// Draw grip in centred in rect.
CGRect gripRect = CGRectMake(0, 0, width, height);
gripRect.origin.x = ((rect.size.width - gripRect.size.width) / 2.0);
gripRect.origin.y = ((rect.size.height - gripRect.size.height) / 2.0);
gripRect.origin.x = ((rect.size.width - gripRect.size.width) / 2.0f);
gripRect.origin.y = ((rect.size.height - gripRect.size.height) / 2.0f);

float stripThickness = 1.0;
UIColor *stripColor = [UIColor colorWithWhite:0.35 alpha:1.0];
UIColor *lightColor = [UIColor colorWithWhite:1.0 alpha:1.0];
UIColor *stripColor = [UIColor colorWithWhite:0.35f alpha:1.0f];
UIColor *lightColor = [UIColor colorWithWhite:1.0f alpha:1.0f];
float space = 3.0;
if (splitViewController.vertical) {
gripRect.size.width = stripThickness;
Expand Down
13 changes: 8 additions & 5 deletions Classes/MGSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define MG_PANESPLITTER_CORNER_RADIUS 0.0 // corner-radius of split-inner corners for MGSplitViewDividerStylePaneSplitter style.
#define MG_PANESPLITTER_SPLIT_WIDTH 25.0 // width of split-gutter for MGSplitViewDividerStylePaneSplitter style.

#define MG_MIN_VIEW_WIDTH 200.0 // minimum width a view is allowed to become as a result of changing the splitPosition.
#define MG_MIN_VIEW_WIDTH 200.0f // minimum width a view is allowed to become as a result of changing the splitPosition.

#define MG_ANIMATION_CHANGE_SPLIT_ORIENTATION @"ChangeSplitOrientation" // Animation ID for internal use.
#define MG_ANIMATION_CHANGE_SUBVIEWS_ORDER @"ChangeSubviewsOrder" // Animation ID for internal use.
Expand Down Expand Up @@ -199,6 +199,8 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
[self layoutSubviewsForInterfaceOrientation:toInterfaceOrientation withAnimation:YES];
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"

- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
Expand All @@ -219,6 +221,7 @@ - (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrie
[self.masterViewController willAnimateSecondHalfOfRotationFromInterfaceOrientation:fromInterfaceOrientation duration:duration];
[self.detailViewController willAnimateSecondHalfOfRotationFromInterfaceOrientation:fromInterfaceOrientation duration:duration];
}
#pragma clang diagnostic pop


- (CGSize)splitViewSizeForOrientation:(UIInterfaceOrientation)theOrientation
Expand Down Expand Up @@ -450,7 +453,7 @@ - (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrienta
CGRect leadingRect, trailingRect;
float radius = leadingCorners.cornerRadius;
if (_vertical) { // left/right split
cornersWidth = (radius * 2.0) + _splitWidth;
cornersWidth = (radius * 2.0f) + _splitWidth;
cornersHeight = radius;
x = ((shouldShowMaster) ? ((masterFirst) ? _splitPosition : width - (_splitPosition + _splitWidth)) : (0 - _splitWidth)) - radius;
y = 0;
Expand All @@ -461,7 +464,7 @@ - (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrienta
x = 0;
y = ((shouldShowMaster) ? ((masterFirst) ? _splitPosition : height - (_splitPosition + _splitWidth)) : (0 - _splitWidth)) - radius;
cornersWidth = radius;
cornersHeight = (radius * 2.0) + _splitWidth;
cornersHeight = (radius * 2.0f) + _splitWidth;
leadingRect = CGRectMake(x, y, cornersWidth, cornersHeight); // left corners
trailingRect = CGRectMake((width - cornersWidth), y, cornersWidth, cornersHeight); // right corners
}
Expand Down Expand Up @@ -935,7 +938,7 @@ - (void)setViewControllers:(NSArray *)controllers
- (UIViewController *)masterViewController
{
if (_viewControllers && [_viewControllers count] > 0) {
NSObject *controller = [_viewControllers objectAtIndex:0];
UIViewController *controller = [_viewControllers objectAtIndex:0];
if ([controller isKindOfClass:[UIViewController class]]) {
return [[controller retain] autorelease];
}
Expand Down Expand Up @@ -977,7 +980,7 @@ - (void)setMasterViewController:(UIViewController *)master
- (UIViewController *)detailViewController
{
if (_viewControllers && [_viewControllers count] > 1) {
NSObject *controller = [_viewControllers objectAtIndex:1];
UIViewController *controller = [_viewControllers objectAtIndex:1];
if ([controller isKindOfClass:[UIViewController class]]) {
return [[controller retain] autorelease];
}
Expand Down
25 changes: 25 additions & 0 deletions MGSplitView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MGSplitView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down Expand Up @@ -227,12 +228,24 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MGSplitView_Prefix.pch;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
INFOPLIST_FILE = "MGSplitView-Info.plist";
PRODUCT_NAME = MGSplitView;
};
Expand All @@ -242,10 +255,22 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MGSplitView_Prefix.pch;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
INFOPLIST_FILE = "MGSplitView-Info.plist";
PRODUCT_NAME = MGSplitView;
VALIDATE_PRODUCT = YES;
Expand Down