Skip to content

Commit

Permalink
Fixed iOS8 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Sprega committed Sep 30, 2014
1 parent 8e1af53 commit 0ece092
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 39 deletions.
24 changes: 20 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Xcode
.DS_Store
*/build/*
*.pbxuser
*.perspectivev3
build
!default.pbxuser
*.mode1v3
.DS_Store

!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
Gemfile.lock
build/*
integration/*
Pods/*
Podfile.local
1 change: 0 additions & 1 deletion Classes/MGSplitCornersView.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ - (id)initWithFrame:(CGRect)frame
- (void)dealloc
{
self.cornerBackgroundColor = nil;

}


Expand Down
4 changes: 3 additions & 1 deletion Classes/MGSplitViewAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
splitViewController.splitWidth = 15.0; // make it wide enough to actually drag!
splitViewController.allowsDraggingDivider = YES;
}


window.rootViewController = self.splitViewController;

return YES;
}

Expand Down
27 changes: 14 additions & 13 deletions Classes/MGSplitViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#define MG_ANIMATION_CHANGE_SPLIT_ORIENTATION @"ChangeSplitOrientation" // Animation ID for internal use.
#define MG_ANIMATION_CHANGE_SUBVIEWS_ORDER @"ChangeSubviewsOrder" // Animation ID for internal use.

#define IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

@interface MGSplitViewController (MGPrivateMethods)

- (void)setup;
Expand Down Expand Up @@ -73,7 +71,7 @@ - (NSString *)nameOfInterfaceOrientation:(UIInterfaceOrientation)theOrientation

- (BOOL)isLandscape
{
return UIInterfaceOrientationIsLandscape(self.interfaceOrientation);
return UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]);
}


Expand All @@ -86,7 +84,7 @@ - (BOOL)shouldShowMasterForInterfaceOrientation:(UIInterfaceOrientation)theOrien

- (BOOL)shouldShowMaster
{
return [self shouldShowMasterForInterfaceOrientation:self.interfaceOrientation];
return [self shouldShowMasterForInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];
}


Expand Down Expand Up @@ -155,7 +153,6 @@ - (void)dealloc
self.masterViewController = nil;
self.detailViewController = nil;
[self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

}


Expand Down Expand Up @@ -216,8 +213,9 @@ - (CGSize)splitViewSizeForOrientation:(UIInterfaceOrientation)theOrientation
float statusBarHeight = MAX((fullScreenRect.size.width - appFrame.size.width), (fullScreenRect.size.height - appFrame.size.height));

// In iOS 7 the status bar is transparent, so don't adjust for it.
if (IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0) {
statusBarHeight = 0;
}

float navigationBarHeight = 0;
if ((self.navigationController)&&(!self.navigationController.navigationBarHidden)) {
Expand All @@ -228,8 +226,8 @@ - (CGSize)splitViewSizeForOrientation:(UIInterfaceOrientation)theOrientation
float width = fullScreenRect.size.width;
float height = fullScreenRect.size.height;

// Correct for orientation.
if (UIInterfaceOrientationIsLandscape(theOrientation)) {
// Correct for orientation (only for iOS7.1 and earlier, since iOS8 it will do it automatically).
if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1 && UIInterfaceOrientationIsLandscape(theOrientation)) {
width = height;
height = fullScreenRect.size.width;
}
Expand Down Expand Up @@ -420,11 +418,11 @@ - (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrienta
leadingCorners = [[MGSplitCornersView alloc] initWithFrame:cornerRect];
leadingCorners.splitViewController = self;
leadingCorners.cornerBackgroundColor = MG_DEFAULT_CORNER_COLOR;
leadingCorners.cornerRadius = [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
leadingCorners.cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
trailingCorners = [[MGSplitCornersView alloc] initWithFrame:cornerRect];
trailingCorners.splitViewController = self;
trailingCorners.cornerBackgroundColor = MG_DEFAULT_CORNER_COLOR;
trailingCorners.cornerRadius = [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
trailingCorners.cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
_cornerViews = [[NSArray alloc] initWithObjects:leadingCorners, trailingCorners, nil];

} else if ([_cornerViews count] == 2) {
Expand Down Expand Up @@ -567,8 +565,11 @@ - (void)reconfigureForMasterInPopover:(BOOL)inPopover

} else if (!inPopover && _hiddenPopoverController && _barButtonItem) {
// I know this looks strange, but it fixes a bizarre issue with UIPopoverController leaving masterViewController's views in disarray.
[_hiddenPopoverController presentPopoverFromRect:CGRectZero inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];

// It does also break stuff on iOS8, so we disable it.
if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) {
[_hiddenPopoverController presentPopoverFromRect:CGRectZero inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];
}

// Remove master from popover and destroy popover, if it exists.
[_hiddenPopoverController dismissPopoverAnimated:NO];
_hiddenPopoverController = nil;
Expand Down Expand Up @@ -1105,7 +1106,7 @@ - (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle
// Reconfigure general appearance and behaviour.
float cornerRadius = 0.0f;
if (_dividerStyle == MGSplitViewDividerStyleThin) {
cornerRadius = [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS;
_splitWidth = MG_DEFAULT_SPLIT_WIDTH;
self.allowsDraggingDivider = NO;

Expand Down
15 changes: 11 additions & 4 deletions MGSplitView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,12 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MGSplitView" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Expand Down Expand Up @@ -227,6 +231,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -242,6 +247,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = MGSplitView_Prefix.pch;
Expand All @@ -255,28 +261,29 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = iphoneos3.2;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = 2;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO;
SDKROOT = iphoneos3.2;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = 2;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
<string>MGSplitView</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>B87E3A15-8AE8-449E-80A8-092ACB80347C</key>
<key>5033EDB6B36AFC1F9AB7153D494FDE66318C7E8E</key>
<string>https://github.com/asprega/MGSplitViewController.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>MGSplitView.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>B87E3A15-8AE8-449E-80A8-092ACB80347C</key>
<key>5033EDB6B36AFC1F9AB7153D494FDE66318C7E8E</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/asprega/MGSplitViewController.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>B87E3A15-8AE8-449E-80A8-092ACB80347C</string>
<string>5033EDB6B36AFC1F9AB7153D494FDE66318C7E8E</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>B87E3A15-8AE8-449E-80A8-092ACB80347C</string>
<string>5033EDB6B36AFC1F9AB7153D494FDE66318C7E8E</string>
<key>IDESourceControlWCCName</key>
<string>MGSplitViewController</string>
</dict>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
LastUpgradeVersion = "0600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
8 changes: 4 additions & 4 deletions MGSplitViewController.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
Pod::Spec.new do |s|

s.name = "MGSplitViewController"
s.version = "1.0.0"
s.summary = "A flexible, advanced split-view controller for iPad developers.."
s.version = "2.0.0"
s.summary = "A flexible, advanced split-view controller for iPad developers."
s.description = <<-DESC
MGSplitViewController is a replacement for UISplitViewController, with various useful enhancements.
MGSplitViewController is a replacement for UISplitViewController, with various useful enhancements. Forked from the original by Matt Gemmel.
DESC

s.homepage = "https://github.com/asprega/MGSplitViewController"
s.license = "BSD"
s.author = { "Andrea Sprega" => "[email protected]" }
s.platform = :ios, "5.0"
s.source = { :git => "https://github.com/asprega/MGSplitViewController.git", :tag => 'v1.0.0' }
s.source = { :git => "https://github.com/asprega/MGSplitViewController.git", :tag => 'v2.0.0' }
s.source_files = "Classes", "Classes/**/*.{h,m}"
s.exclude_files = "Classes/Exclude"
s.requires_arc = true
Expand Down
13 changes: 7 additions & 6 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
#import "MGSplitViewAppDelegate.h"

int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MGSplitViewAppDelegate class]));
}
}

0 comments on commit 0ece092

Please sign in to comment.