author | Wuzzy <Wuzzy2@mail.ru> |
Mon, 08 Apr 2019 17:59:38 +0200 | |
changeset 14776 | 97a36fb44123 |
parent 11221 | e68b3e392091 |
permissions | -rwxr-xr-x |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1 |
// |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
2 |
// MGSplitViewController.m |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
3 |
// MGSplitView |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
4 |
// |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
5 |
// Created by Matt Gemmell on 26/07/2010. |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
6 |
// Copyright 2010 Instinctive Code. |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
7 |
// |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
8 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
9 |
#import "MGSplitViewController.h" |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
10 |
#import "MGSplitDividerView.h" |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
11 |
#import "MGSplitCornersView.h" |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
12 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
13 |
#define MG_DEFAULT_SPLIT_POSITION 320.0 // default width of master view in UISplitViewController. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
14 |
#define MG_DEFAULT_SPLIT_WIDTH 1.0 // default width of split-gutter in UISplitViewController. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
15 |
#define MG_DEFAULT_CORNER_RADIUS 5.0 // default corner-radius of overlapping split-inner corners on the master and detail views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
16 |
#define MG_DEFAULT_CORNER_COLOR [UIColor blackColor] // default color of intruding inner corners (and divider background). |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
17 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
18 |
#define MG_PANESPLITTER_CORNER_RADIUS 0.0 // corner-radius of split-inner corners for MGSplitViewDividerStylePaneSplitter style. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
19 |
#define MG_PANESPLITTER_SPLIT_WIDTH 25.0 // width of split-gutter for MGSplitViewDividerStylePaneSplitter style. |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
20 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
21 |
#define MG_MIN_VIEW_WIDTH 200.0 // minimum width a view is allowed to become as a result of changing the splitPosition. |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
22 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
23 |
#define MG_ANIMATION_CHANGE_SPLIT_ORIENTATION @"ChangeSplitOrientation" // Animation ID for internal use. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
24 |
#define MG_ANIMATION_CHANGE_SUBVIEWS_ORDER @"ChangeSubviewsOrder" // Animation ID for internal use. |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
25 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
26 |
@interface MGSplitViewController (MGPrivateMethods) |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
27 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
28 |
- (void)setup; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
29 |
- (CGSize)splitViewSizeForOrientation:(UIInterfaceOrientation)theOrientation; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
30 |
- (void)layoutSubviews; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
31 |
- (void)layoutSubviewsWithAnimation:(BOOL)animate; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
32 |
- (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrientation withAnimation:(BOOL)animate; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
33 |
- (BOOL)shouldShowMasterForInterfaceOrientation:(UIInterfaceOrientation)theOrientation; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
34 |
- (BOOL)shouldShowMaster; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
35 |
- (NSString *)nameOfInterfaceOrientation:(UIInterfaceOrientation)theOrientation; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
36 |
- (void)reconfigureForMasterInPopover:(BOOL)inPopover; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
37 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
38 |
@end |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
39 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
40 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
41 |
@implementation MGSplitViewController |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
42 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
43 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
44 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
45 |
#pragma mark Orientation helpers |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
46 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
47 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
48 |
- (NSString *)nameOfInterfaceOrientation:(UIInterfaceOrientation)theOrientation |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
49 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
50 |
NSString *orientationName = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
51 |
switch (theOrientation) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
52 |
case UIInterfaceOrientationPortrait: |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
53 |
orientationName = @"Portrait"; // Home button at bottom |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
54 |
break; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
55 |
case UIInterfaceOrientationPortraitUpsideDown: |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
56 |
orientationName = @"Portrait (Upside Down)"; // Home button at top |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
57 |
break; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
58 |
case UIInterfaceOrientationLandscapeLeft: |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
59 |
orientationName = @"Landscape (Left)"; // Home button on left |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
60 |
break; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
61 |
case UIInterfaceOrientationLandscapeRight: |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
62 |
orientationName = @"Landscape (Right)"; // Home button on right |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
63 |
break; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
64 |
default: |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
65 |
break; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
66 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
67 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
68 |
return orientationName; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
69 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
70 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
71 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
72 |
- (BOOL)isLandscape |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
73 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
74 |
return UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]); |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
75 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
76 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
77 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
78 |
- (BOOL)shouldShowMasterForInterfaceOrientation:(UIInterfaceOrientation)theOrientation |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
79 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
80 |
// Returns YES if master view should be shown directly embedded in the splitview, instead of hidden in a popover. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
81 |
return ((UIInterfaceOrientationIsLandscape(theOrientation)) ? _showsMasterInLandscape : _showsMasterInPortrait); |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
82 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
83 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
84 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
85 |
- (BOOL)shouldShowMaster |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
86 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
87 |
return [self shouldShowMasterForInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
88 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
89 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
90 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
91 |
- (BOOL)isShowingMaster |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
92 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
93 |
return [self shouldShowMaster] && self.masterViewController && self.masterViewController.view && ([self.masterViewController.view superview] == self.view); |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
94 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
95 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
96 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
97 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
98 |
#pragma mark Setup and Teardown |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
99 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
100 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
101 |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
102 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
103 |
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
104 |
[self setup]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
105 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
106 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
107 |
return self; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
108 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
109 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
110 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
111 |
- (id)initWithCoder:(NSCoder *)aDecoder |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
112 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
113 |
if ((self = [super initWithCoder:aDecoder])) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
114 |
[self setup]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
115 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
116 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
117 |
return self; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
118 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
119 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
120 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
121 |
- (void)setup |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
122 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
123 |
// Configure default behaviour. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
124 |
_viewControllers = [[NSMutableArray alloc] initWithObjects:[NSNull null], [NSNull null], nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
125 |
_splitWidth = MG_DEFAULT_SPLIT_WIDTH; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
126 |
_showsMasterInPortrait = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
127 |
_showsMasterInLandscape = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
128 |
_reconfigurePopup = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
129 |
_vertical = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
130 |
_masterBeforeDetail = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
131 |
_splitPosition = MG_DEFAULT_SPLIT_POSITION; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
132 |
CGRect divRect = self.view.bounds; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
133 |
if ([self isVertical]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
134 |
divRect.origin.y = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
135 |
divRect.size.height = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
136 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
137 |
divRect.origin.x = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
138 |
divRect.size.width = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
139 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
140 |
_dividerView = [[MGSplitDividerView alloc] initWithFrame:divRect]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
141 |
_dividerView.splitViewController = self; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
142 |
_dividerView.backgroundColor = MG_DEFAULT_CORNER_COLOR; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
143 |
_dividerStyle = MGSplitViewDividerStyleThin; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
144 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
145 |
// fix for iOS 6 layout |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
146 |
self.view.autoresizesSubviews = NO; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
147 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
148 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
149 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
150 |
- (void)dealloc |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
151 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
152 |
_delegate = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
153 |
_viewControllers = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
154 |
[self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
155 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
156 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
157 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
158 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
159 |
#pragma mark View management |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
160 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
161 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
162 |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
163 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
164 |
if (self.detailViewController) |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
165 |
{ |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
166 |
return [self.detailViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
167 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
168 |
|
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
169 |
return YES; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
170 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
171 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
172 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
173 |
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
174 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
175 |
[self.masterViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
176 |
[self.detailViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
177 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
178 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
179 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
180 |
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
181 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
182 |
[self.masterViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
183 |
[self.detailViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
184 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
185 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
186 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
187 |
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
188 |
duration:(NSTimeInterval)duration |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
189 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
190 |
[self.masterViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
191 |
[self.detailViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
192 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
193 |
// Hide popover. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
194 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
195 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
196 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
197 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
198 |
// Re-tile views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
199 |
_reconfigurePopup = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
200 |
[self layoutSubviewsForInterfaceOrientation:toInterfaceOrientation withAnimation:YES]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
201 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
202 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
203 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
204 |
- (CGSize)splitViewSizeForOrientation:(UIInterfaceOrientation)theOrientation |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
205 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
206 |
UIScreen *screen = [UIScreen mainScreen]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
207 |
CGRect fullScreenRect = screen.bounds; // always implicitly in Portrait orientation. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
208 |
CGRect appFrame = screen.applicationFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
209 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
210 |
// Find status bar height by checking which dimension of the applicationFrame is narrower than screen bounds. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
211 |
// Little bit ugly looking, but it'll still work even if they change the status bar height in future. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
212 |
float statusBarHeight = MAX((fullScreenRect.size.width - appFrame.size.width), (fullScreenRect.size.height - appFrame.size.height)); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
213 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
214 |
// In iOS 7 the status bar is transparent, so don't adjust for it. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
215 |
if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
216 |
statusBarHeight = 0; |
8441 | 217 |
} |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
218 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
219 |
float navigationBarHeight = 0; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
220 |
if ((self.navigationController)&&(!self.navigationController.navigationBarHidden)) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
221 |
navigationBarHeight = self.navigationController.navigationBar.frame.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
222 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
223 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
224 |
// Initially assume portrait orientation. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
225 |
float width = fullScreenRect.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
226 |
float height = fullScreenRect.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
227 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
228 |
// Correct for orientation (only for iOS7.1 and earlier, since iOS8 it will do it automatically). |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
229 |
if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1 && UIInterfaceOrientationIsLandscape(theOrientation)) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
230 |
width = height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
231 |
height = fullScreenRect.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
232 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
233 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
234 |
// Account for status bar, which always subtracts from the height (since it's always at the top of the screen). |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
235 |
height -= statusBarHeight; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
236 |
height -= navigationBarHeight; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
237 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
238 |
return CGSizeMake(width, height); |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
239 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
240 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
241 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
242 |
- (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrientation withAnimation:(BOOL)animate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
243 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
244 |
if (_reconfigurePopup) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
245 |
[self reconfigureForMasterInPopover:![self shouldShowMasterForInterfaceOrientation:theOrientation]]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
246 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
247 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
248 |
// Layout the master, detail and divider views appropriately, adding/removing subviews as needed. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
249 |
// First obtain relevant geometry. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
250 |
CGSize fullSize = [self splitViewSizeForOrientation:theOrientation]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
251 |
float width = fullSize.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
252 |
float height = fullSize.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
253 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
254 |
if (NO) { // Just for debugging. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
255 |
NSLog(@"Target orientation is %@, dimensions will be %.0f x %.0f", |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
256 |
[self nameOfInterfaceOrientation:theOrientation], width, height); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
257 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
258 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
259 |
// Layout the master, divider and detail views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
260 |
CGRect newFrame = CGRectMake(0, 0, width, height); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
261 |
UIViewController *controller; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
262 |
UIView *theView; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
263 |
BOOL shouldShowMaster = [self shouldShowMasterForInterfaceOrientation:theOrientation]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
264 |
BOOL masterFirst = [self isMasterBeforeDetail]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
265 |
if ([self isVertical]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
266 |
// Master on left, detail on right (or vice versa). |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
267 |
CGRect masterRect, dividerRect, detailRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
268 |
if (masterFirst) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
269 |
if (!shouldShowMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
270 |
// Move off-screen. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
271 |
newFrame.origin.x -= (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
272 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
273 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
274 |
newFrame.size.width = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
275 |
masterRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
276 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
277 |
newFrame.origin.x += newFrame.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
278 |
newFrame.size.width = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
279 |
dividerRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
280 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
281 |
newFrame.origin.x += newFrame.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
282 |
newFrame.size.width = width - newFrame.origin.x; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
283 |
detailRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
284 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
285 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
286 |
if (!shouldShowMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
287 |
// Move off-screen. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
288 |
newFrame.size.width += (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
289 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
290 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
291 |
newFrame.size.width -= (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
292 |
detailRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
293 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
294 |
newFrame.origin.x += newFrame.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
295 |
newFrame.size.width = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
296 |
dividerRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
297 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
298 |
newFrame.origin.x += newFrame.size.width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
299 |
newFrame.size.width = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
300 |
masterRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
301 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
302 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
303 |
// Position master. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
304 |
controller = self.masterViewController; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
305 |
if (controller && [controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
306 |
theView = controller.view; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
307 |
if (theView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
308 |
theView.frame = masterRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
309 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
310 |
[controller viewWillAppear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
311 |
[self.view addSubview:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
312 |
[controller viewDidAppear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
313 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
314 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
315 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
316 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
317 |
// Position divider. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
318 |
theView = _dividerView; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
319 |
theView.frame = dividerRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
320 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
321 |
[self.view addSubview:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
322 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
323 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
324 |
// Position detail. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
325 |
controller = self.detailViewController; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
326 |
if (controller && [controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
327 |
theView = controller.view; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
328 |
if (theView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
329 |
theView.frame = detailRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
330 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
331 |
[self.view insertSubview:theView aboveSubview:self.masterViewController.view]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
332 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
333 |
[self.view bringSubviewToFront:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
334 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
335 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
336 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
337 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
338 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
339 |
// Master above, detail below (or vice versa). |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
340 |
CGRect masterRect, dividerRect, detailRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
341 |
if (masterFirst) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
342 |
if (!shouldShowMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
343 |
// Move off-screen. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
344 |
newFrame.origin.y -= (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
345 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
346 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
347 |
newFrame.size.height = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
348 |
masterRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
349 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
350 |
newFrame.origin.y += newFrame.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
351 |
newFrame.size.height = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
352 |
dividerRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
353 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
354 |
newFrame.origin.y += newFrame.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
355 |
newFrame.size.height = height - newFrame.origin.y; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
356 |
detailRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
357 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
358 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
359 |
if (!shouldShowMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
360 |
// Move off-screen. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
361 |
newFrame.size.height += (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
362 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
363 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
364 |
newFrame.size.height -= (_splitPosition + _splitWidth); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
365 |
detailRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
366 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
367 |
newFrame.origin.y += newFrame.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
368 |
newFrame.size.height = _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
369 |
dividerRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
370 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
371 |
newFrame.origin.y += newFrame.size.height; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
372 |
newFrame.size.height = _splitPosition; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
373 |
masterRect = newFrame; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
374 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
375 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
376 |
// Position master. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
377 |
controller = self.masterViewController; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
378 |
if (controller && [controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
379 |
theView = controller.view; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
380 |
if (theView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
381 |
theView.frame = masterRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
382 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
383 |
[controller viewWillAppear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
384 |
[self.view addSubview:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
385 |
[controller viewDidAppear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
386 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
387 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
388 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
389 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
390 |
// Position divider. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
391 |
theView = _dividerView; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
392 |
theView.frame = dividerRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
393 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
394 |
[self.view addSubview:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
395 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
396 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
397 |
// Position detail. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
398 |
controller = self.detailViewController; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
399 |
if (controller && [controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
400 |
theView = controller.view; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
401 |
if (theView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
402 |
theView.frame = detailRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
403 |
if (!theView.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
404 |
[self.view insertSubview:theView aboveSubview:self.masterViewController.view]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
405 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
406 |
[self.view bringSubviewToFront:theView]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
407 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
408 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
409 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
410 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
411 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
412 |
// Create corner views if necessary. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
413 |
MGSplitCornersView *leadingCorners = nil; // top/left of screen in vertical/horizontal split. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
414 |
MGSplitCornersView *trailingCorners = nil; // bottom/right of screen in vertical/horizontal split. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
415 |
if (!_cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
416 |
CGRect cornerRect = CGRectMake(0, 0, 10, 10); // arbitrary, will be resized below. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
417 |
leadingCorners = [[MGSplitCornersView alloc] initWithFrame:cornerRect]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
418 |
leadingCorners.splitViewController = self; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
419 |
leadingCorners.cornerBackgroundColor = MG_DEFAULT_CORNER_COLOR; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
420 |
leadingCorners.cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
421 |
trailingCorners = [[MGSplitCornersView alloc] initWithFrame:cornerRect]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
422 |
trailingCorners.splitViewController = self; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
423 |
trailingCorners.cornerBackgroundColor = MG_DEFAULT_CORNER_COLOR; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
424 |
trailingCorners.cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
425 |
_cornerViews = [[NSArray alloc] initWithObjects:leadingCorners, trailingCorners, nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
426 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
427 |
} else if ([_cornerViews count] == 2) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
428 |
leadingCorners = [_cornerViews objectAtIndex:0]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
429 |
trailingCorners = [_cornerViews objectAtIndex:1]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
430 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
431 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
432 |
// Configure and layout the corner-views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
433 |
leadingCorners.cornersPosition = (_vertical) ? MGCornersPositionLeadingVertical : MGCornersPositionLeadingHorizontal; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
434 |
trailingCorners.cornersPosition = (_vertical) ? MGCornersPositionTrailingVertical : MGCornersPositionTrailingHorizontal; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
435 |
leadingCorners.autoresizingMask = (_vertical) ? UIViewAutoresizingFlexibleBottomMargin : UIViewAutoresizingFlexibleRightMargin; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
436 |
trailingCorners.autoresizingMask = (_vertical) ? UIViewAutoresizingFlexibleTopMargin : UIViewAutoresizingFlexibleLeftMargin; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
437 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
438 |
float x, y, cornersWidth, cornersHeight; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
439 |
CGRect leadingRect, trailingRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
440 |
float radius = leadingCorners.cornerRadius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
441 |
if (_vertical) { // left/right split |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
442 |
cornersWidth = (radius * 2.f) + _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
443 |
cornersHeight = radius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
444 |
x = ((shouldShowMaster) ? ((masterFirst) ? _splitPosition : width - (_splitPosition + _splitWidth)) : (0 - _splitWidth)) - radius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
445 |
y = 0; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
446 |
leadingRect = CGRectMake(x, y, cornersWidth, cornersHeight); // top corners |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
447 |
trailingRect = CGRectMake(x, (height - cornersHeight), cornersWidth, cornersHeight); // bottom corners |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
448 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
449 |
} else { // top/bottom split |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
450 |
x = 0; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
451 |
y = ((shouldShowMaster) ? ((masterFirst) ? _splitPosition : height - (_splitPosition + _splitWidth)) : (0 - _splitWidth)) - radius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
452 |
cornersWidth = radius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
453 |
cornersHeight = (radius * 2.f) + _splitWidth; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
454 |
leadingRect = CGRectMake(x, y, cornersWidth, cornersHeight); // left corners |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
455 |
trailingRect = CGRectMake((width - cornersWidth), y, cornersWidth, cornersHeight); // right corners |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
456 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
457 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
458 |
leadingCorners.frame = leadingRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
459 |
trailingCorners.frame = trailingRect; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
460 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
461 |
// Ensure corners are visible and frontmost. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
462 |
if (!leadingCorners.superview) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
463 |
[self.view insertSubview:leadingCorners aboveSubview:self.detailViewController.view]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
464 |
[self.view insertSubview:trailingCorners aboveSubview:self.detailViewController.view]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
465 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
466 |
[self.view bringSubviewToFront:leadingCorners]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
467 |
[self.view bringSubviewToFront:trailingCorners]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
468 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
469 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
470 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
471 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
472 |
- (void)layoutSubviewsWithAnimation:(BOOL)animate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
473 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
474 |
[self layoutSubviewsForInterfaceOrientation:self.interfaceOrientation withAnimation:animate]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
475 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
476 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
477 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
478 |
- (void)layoutSubviews |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
479 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
480 |
[self layoutSubviewsForInterfaceOrientation:self.interfaceOrientation withAnimation:YES]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
481 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
482 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
483 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
484 |
- (void)viewWillAppear:(BOOL)animated |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
485 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
486 |
[super viewWillAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
487 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
488 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
489 |
[self.masterViewController viewWillAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
490 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
491 |
[self.detailViewController viewWillAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
492 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
493 |
_reconfigurePopup = YES; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
494 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
495 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
496 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
497 |
- (void)viewDidAppear:(BOOL)animated |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
498 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
499 |
[super viewDidAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
500 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
501 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
502 |
[self.masterViewController viewDidAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
503 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
504 |
[self.detailViewController viewDidAppear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
505 |
[self layoutSubviews]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
506 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
507 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
508 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
509 |
- (void)viewWillDisappear:(BOOL)animated |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
510 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
511 |
[super viewWillDisappear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
512 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
513 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
514 |
[self.masterViewController viewWillDisappear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
515 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
516 |
[self.detailViewController viewWillDisappear:animated]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
517 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
518 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
519 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
520 |
- (void)viewDidDisappear:(BOOL)animated |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
521 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
522 |
[super viewDidDisappear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
523 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
524 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
525 |
[self.masterViewController viewDidDisappear:animated]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
526 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
527 |
[self.detailViewController viewDidDisappear:animated]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
528 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
529 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
530 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
531 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
532 |
#pragma mark Popover handling |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
533 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
534 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
535 |
- (void)reconfigureForMasterInPopover:(BOOL)inPopover |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
536 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
537 |
_reconfigurePopup = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
538 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
539 |
if ((inPopover && _hiddenPopoverController) || (!inPopover && !_hiddenPopoverController) || !self.masterViewController) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
540 |
// Nothing to do. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
541 |
return; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
542 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
543 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
544 |
if (inPopover && !_hiddenPopoverController && !_barButtonItem) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
545 |
// Create and configure popover for our masterViewController. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
546 |
_hiddenPopoverController = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
547 |
[self.masterViewController viewWillDisappear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
548 |
_hiddenPopoverController = [[UIPopoverController alloc] initWithContentViewController:self.masterViewController]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
549 |
[self.masterViewController viewDidDisappear:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
550 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
551 |
// Create and configure _barButtonItem. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
552 |
_barButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Master", nil) |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
553 |
style:UIBarButtonItemStyleBordered |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
554 |
target:self |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
555 |
action:(self.togglesMasterPopover ? @selector(toggleMasterPopover:) : @selector(showMasterPopover:))]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
556 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
557 |
// Inform delegate of this state of affairs. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
558 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:willHideViewController:withBarButtonItem:forPopoverController:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
559 |
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
560 |
willHideViewController:self.masterViewController |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
561 |
withBarButtonItem:_barButtonItem |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
562 |
forPopoverController:_hiddenPopoverController]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
563 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
564 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
565 |
} else if (!inPopover && _hiddenPopoverController && _barButtonItem) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
566 |
// I know this looks strange, but it fixes a bizarre issue with UIPopoverController leaving masterViewController's views in disarray. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
567 |
// It does also break stuff on iOS8, so we disable it. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
568 |
if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
569 |
[_hiddenPopoverController presentPopoverFromRect:CGRectZero inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO]; |
8441 | 570 |
} |
571 |
||
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
572 |
// Remove master from popover and destroy popover, if it exists. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
573 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
574 |
_hiddenPopoverController = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
575 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
576 |
// Inform delegate that the _barButtonItem will become invalid. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
577 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:willShowViewController:invalidatingBarButtonItem:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
578 |
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
579 |
willShowViewController:self.masterViewController |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
580 |
invalidatingBarButtonItem:_barButtonItem]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
581 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
582 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
583 |
// Destroy _barButtonItem. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
584 |
_barButtonItem = nil; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
585 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
586 |
// Move master view. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
587 |
UIView *masterView = self.masterViewController.view; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
588 |
if (masterView && masterView.superview != self.view) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
589 |
[masterView removeFromSuperview]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
590 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
591 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
592 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
593 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
594 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
595 |
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
596 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
597 |
[self reconfigureForMasterInPopover:NO]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
598 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
599 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
600 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
601 |
- (void)notePopoverDismissed |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
602 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
603 |
[self popoverControllerDidDismissPopover:_hiddenPopoverController]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
604 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
605 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
606 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
607 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
608 |
#pragma mark Animations |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
609 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
610 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
611 |
- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
612 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
613 |
if (([animationID isEqualToString:MG_ANIMATION_CHANGE_SPLIT_ORIENTATION] || |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
614 |
[animationID isEqualToString:MG_ANIMATION_CHANGE_SUBVIEWS_ORDER]) |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
615 |
&& _cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
616 |
for (UIView *corner in _cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
617 |
corner.hidden = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
618 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
619 |
_dividerView.hidden = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
620 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
621 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
622 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
623 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
624 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
625 |
#pragma mark IB Actions |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
626 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
627 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
628 |
- (IBAction)toggleSplitOrientation:(id)sender |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
629 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
630 |
BOOL showingMaster = [self isShowingMaster]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
631 |
if (showingMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
632 |
if (_cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
633 |
for (UIView *corner in _cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
634 |
corner.hidden = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
635 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
636 |
_dividerView.hidden = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
637 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
638 |
[UIView beginAnimations:MG_ANIMATION_CHANGE_SPLIT_ORIENTATION context:nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
639 |
[UIView setAnimationDelegate:self]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
640 |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
641 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
642 |
self.vertical = (!self.vertical); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
643 |
if (showingMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
644 |
[UIView commitAnimations]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
645 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
646 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
647 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
648 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
649 |
- (IBAction)toggleMasterBeforeDetail:(id)sender |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
650 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
651 |
BOOL showingMaster = [self isShowingMaster]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
652 |
if (showingMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
653 |
if (_cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
654 |
for (UIView *corner in _cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
655 |
corner.hidden = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
656 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
657 |
_dividerView.hidden = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
658 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
659 |
[UIView beginAnimations:MG_ANIMATION_CHANGE_SUBVIEWS_ORDER context:nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
660 |
[UIView setAnimationDelegate:self]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
661 |
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
662 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
663 |
self.masterBeforeDetail = (!self.masterBeforeDetail); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
664 |
if (showingMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
665 |
[UIView commitAnimations]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
666 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
667 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
668 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
669 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
670 |
- (IBAction)toggleMasterView:(id)sender |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
671 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
672 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
673 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
674 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
675 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
676 |
if (![self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
677 |
// We're about to show the master view. Ensure it's in place off-screen to be animated in. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
678 |
_reconfigurePopup = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
679 |
[self reconfigureForMasterInPopover:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
680 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
681 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
682 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
683 |
// This action functions on the current primary orientation; it is independent of the other primary orientation. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
684 |
[UIView beginAnimations:@"toggleMaster" context:nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
685 |
if (self.isLandscape) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
686 |
self.showsMasterInLandscape = !_showsMasterInLandscape; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
687 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
688 |
self.showsMasterInPortrait = !_showsMasterInPortrait; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
689 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
690 |
[UIView commitAnimations]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
691 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
692 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
693 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
694 |
- (void) setTogglesMasterPopover:(BOOL)flag { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
695 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
696 |
togglesMasterPopover = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
697 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
698 |
if (!_barButtonItem) |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
699 |
return; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
700 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
701 |
_barButtonItem.action = flag ? @selector(toggleMasterPopover:) : @selector(showMasterPopover:); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
702 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
703 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
704 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
705 |
- (IBAction)toggleMasterPopover:(id)sender |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
706 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
707 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
708 |
if (!_hiddenPopoverController) |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
709 |
return; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
710 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
711 |
if (_hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
712 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
713 |
[self hideMasterPopover:sender]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
714 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
715 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
716 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
717 |
[self showMasterPopover:sender]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
718 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
719 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
720 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
721 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
722 |
|
8441 | 723 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
724 |
- (IBAction)showMasterPopover:(id)sender |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
725 |
{ |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
726 |
if (_hiddenPopoverController && !(_hiddenPopoverController.popoverVisible)) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
727 |
// Inform delegate. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
728 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:popoverController:willPresentViewController:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
729 |
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
730 |
popoverController:_hiddenPopoverController |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
731 |
willPresentViewController:self.masterViewController]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
732 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
733 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
734 |
// Show popover. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
735 |
[_hiddenPopoverController presentPopoverFromBarButtonItem:(sender ? sender : _barButtonItem) permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
736 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
737 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
738 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
739 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
740 |
- (IBAction)hideMasterPopover:(id)sender |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
741 |
{ |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
742 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
743 |
if(_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
744 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
745 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:popoverController:willDismissViewController:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
746 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
747 |
[(NSObject <MGSplitViewControllerDelegate> *)_delegate splitViewController:self popoverController:_hiddenPopoverController willDismissViewController:self.masterViewController]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
748 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
749 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
750 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
751 |
[_hiddenPopoverController dismissPopoverAnimated:YES]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
752 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
753 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
754 |
|
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
755 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
756 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
757 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
758 |
#pragma mark - |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
759 |
#pragma mark Accessors and properties |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
760 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
761 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
762 |
- (id)delegate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
763 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
764 |
return _delegate; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
765 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
766 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
767 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
768 |
- (void)setDelegate:(id <MGSplitViewControllerDelegate>)newDelegate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
769 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
770 |
if (newDelegate != _delegate && |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
771 |
(!newDelegate || [(NSObject *)newDelegate conformsToProtocol:@protocol(MGSplitViewControllerDelegate)])) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
772 |
_delegate = newDelegate; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
773 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
774 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
775 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
776 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
777 |
- (BOOL)showsMasterInPortrait |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
778 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
779 |
return _showsMasterInPortrait; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
780 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
781 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
782 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
783 |
- (void)setShowsMasterInPortrait:(BOOL)flag |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
784 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
785 |
if (flag != _showsMasterInPortrait) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
786 |
_showsMasterInPortrait = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
787 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
788 |
if (![self isLandscape]) { // i.e. if this will cause a visual change. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
789 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
790 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
791 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
792 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
793 |
// Rearrange views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
794 |
_reconfigurePopup = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
795 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
796 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
797 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
798 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
799 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
800 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
801 |
- (BOOL)showsMasterInLandscape |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
802 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
803 |
return _showsMasterInLandscape; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
804 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
805 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
806 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
807 |
- (void)setShowsMasterInLandscape:(BOOL)flag |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
808 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
809 |
if (flag != _showsMasterInLandscape) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
810 |
_showsMasterInLandscape = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
811 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
812 |
if ([self isLandscape]) { // i.e. if this will cause a visual change. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
813 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
814 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
815 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
816 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
817 |
// Rearrange views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
818 |
_reconfigurePopup = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
819 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
820 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
821 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
822 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
823 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
824 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
825 |
- (BOOL)isVertical |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
826 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
827 |
return _vertical; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
828 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
829 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
830 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
831 |
- (void)setVertical:(BOOL)flag |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
832 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
833 |
if (flag != _vertical) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
834 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
835 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
836 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
837 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
838 |
_vertical = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
839 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
840 |
// Inform delegate. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
841 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:willChangeSplitOrientationToVertical:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
842 |
[_delegate splitViewController:self willChangeSplitOrientationToVertical:_vertical]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
843 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
844 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
845 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
846 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
847 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
848 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
849 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
850 |
- (BOOL)isMasterBeforeDetail |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
851 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
852 |
return _masterBeforeDetail; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
853 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
854 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
855 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
856 |
- (void)setMasterBeforeDetail:(BOOL)flag |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
857 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
858 |
if (flag != _masterBeforeDetail) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
859 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
860 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
861 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
862 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
863 |
_masterBeforeDetail = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
864 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
865 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
866 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
867 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
868 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
869 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
870 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
871 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
872 |
- (float)splitPosition |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
873 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
874 |
return _splitPosition; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
875 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
876 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
877 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
878 |
- (void)setSplitPosition:(float)posn |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
879 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
880 |
// Check to see if delegate wishes to constrain the position. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
881 |
float newPosn = posn; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
882 |
BOOL constrained = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
883 |
CGSize fullSize = [self splitViewSizeForOrientation:self.interfaceOrientation]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
884 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:constrainSplitPosition:splitViewSize:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
885 |
newPosn = [_delegate splitViewController:self constrainSplitPosition:newPosn splitViewSize:fullSize]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
886 |
constrained = YES; // implicitly trust delegate's response. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
887 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
888 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
889 |
// Apply default constraints if delegate doesn't wish to participate. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
890 |
float minPos = MG_MIN_VIEW_WIDTH; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
891 |
float maxPos = (float) (((_vertical) ? fullSize.width : fullSize.height) - (MG_MIN_VIEW_WIDTH + _splitWidth)); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
892 |
constrained = (newPosn != _splitPosition && newPosn >= minPos && newPosn <= maxPos); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
893 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
894 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
895 |
if (constrained) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
896 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
897 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
898 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
899 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
900 |
_splitPosition = newPosn; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
901 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
902 |
// Inform delegate. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
903 |
if (_delegate && [_delegate respondsToSelector:@selector(splitViewController:willMoveSplitToPosition:)]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
904 |
[_delegate splitViewController:self willMoveSplitToPosition:_splitPosition]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
905 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
906 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
907 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
908 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
909 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
910 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
911 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
912 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
913 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
914 |
- (void)setSplitPosition:(float)posn animated:(BOOL)animate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
915 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
916 |
BOOL shouldAnimate = (animate && [self isShowingMaster]); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
917 |
if (shouldAnimate) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
918 |
[UIView beginAnimations:@"SplitPosition" context:nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
919 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
920 |
[self setSplitPosition:posn]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
921 |
if (shouldAnimate) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
922 |
[UIView commitAnimations]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
923 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
924 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
925 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
926 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
927 |
- (float)splitWidth |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
928 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
929 |
return _splitWidth; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
930 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
931 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
932 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
933 |
- (void)setSplitWidth:(float)width |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
934 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
935 |
if (width != _splitWidth && width >= 0) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
936 |
_splitWidth = width; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
937 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
938 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
939 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
940 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
941 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
942 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
943 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
944 |
- (NSArray *)viewControllers |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
945 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
946 |
return [_viewControllers copy]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
947 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
948 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
949 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
950 |
- (void)setViewControllers:(NSArray *)controllers |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
951 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
952 |
if (controllers != _viewControllers) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
953 |
for (UIViewController *controller in _viewControllers) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
954 |
if ([controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
955 |
[controller.view removeFromSuperview]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
956 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
957 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
958 |
_viewControllers = [[NSMutableArray alloc] initWithCapacity:2]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
959 |
if (controllers && [controllers count] >= 2) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
960 |
self.masterViewController = [controllers objectAtIndex:0]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
961 |
self.detailViewController = [controllers objectAtIndex:1]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
962 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
963 |
NSLog(@"Error: %@ requires 2 view-controllers. (%@)", NSStringFromClass([self class]), NSStringFromSelector(_cmd)); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
964 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
965 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
966 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
967 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
968 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
969 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
970 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
971 |
- (UIViewController *)masterViewController |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
972 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
973 |
if (_viewControllers && [_viewControllers count] > 0) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
974 |
UIViewController *controller = (UIViewController *)[_viewControllers objectAtIndex:0]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
975 |
if ([controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
976 |
return controller; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
977 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
978 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
979 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
980 |
return nil; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
981 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
982 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
983 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
984 |
- (void)setMasterViewController:(UIViewController *)master |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
985 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
986 |
if (!_viewControllers) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
987 |
_viewControllers = [[NSMutableArray alloc] initWithCapacity:2]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
988 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
989 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
990 |
NSObject *newMaster = master; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
991 |
if (!newMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
992 |
newMaster = [NSNull null]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
993 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
994 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
995 |
BOOL changed = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
996 |
if ([_viewControllers count] > 0) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
997 |
if ([_viewControllers objectAtIndex:0] == newMaster) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
998 |
changed = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
999 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1000 |
[_viewControllers replaceObjectAtIndex:0 withObject:newMaster]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1001 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1002 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1003 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1004 |
[_viewControllers addObject:newMaster]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1005 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1006 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1007 |
if (changed) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1008 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1009 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1010 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1011 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1012 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1013 |
- (UIViewController *)detailViewController |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1014 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1015 |
if (_viewControllers && [_viewControllers count] > 1) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1016 |
UIViewController *controller = (UIViewController *)[_viewControllers objectAtIndex:1]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1017 |
if ([controller isKindOfClass:[UIViewController class]]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1018 |
return controller; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1019 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1020 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1021 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1022 |
return nil; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1023 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1024 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1025 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1026 |
- (void)setDetailViewController:(UIViewController *)detail |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1027 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1028 |
if (!_viewControllers) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1029 |
_viewControllers = [[NSMutableArray alloc] initWithCapacity:2]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1030 |
[_viewControllers addObject:[NSNull null]]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1031 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1032 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1033 |
BOOL changed = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1034 |
if ([_viewControllers count] > 1) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1035 |
if ([_viewControllers objectAtIndex:1] == detail) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1036 |
changed = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1037 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1038 |
[_viewControllers replaceObjectAtIndex:1 withObject:detail]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1039 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1040 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1041 |
} else { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1042 |
[_viewControllers addObject:detail]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1043 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1044 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1045 |
if (changed) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1046 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1047 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1048 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1049 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1050 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1051 |
- (MGSplitDividerView *)dividerView |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1052 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1053 |
return _dividerView; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1054 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1055 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1056 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1057 |
- (void)setDividerView:(MGSplitDividerView *)divider |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1058 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1059 |
if (divider != _dividerView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1060 |
[_dividerView removeFromSuperview]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1061 |
_dividerView = divider; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1062 |
_dividerView.splitViewController = self; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1063 |
_dividerView.backgroundColor = MG_DEFAULT_CORNER_COLOR; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1064 |
if ([self isShowingMaster]) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1065 |
[self layoutSubviews]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1066 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1067 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1068 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1069 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1070 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1071 |
- (BOOL)allowsDraggingDivider |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1072 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1073 |
if (_dividerView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1074 |
return _dividerView.allowsDragging; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1075 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1076 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1077 |
return NO; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1078 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1079 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1080 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1081 |
- (void)setAllowsDraggingDivider:(BOOL)flag |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1082 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1083 |
if (self.allowsDraggingDivider != flag && _dividerView) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1084 |
_dividerView.allowsDragging = flag; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1085 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1086 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1087 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1088 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1089 |
- (MGSplitViewDividerStyle)dividerStyle |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1090 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1091 |
return _dividerStyle; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1092 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1093 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1094 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1095 |
- (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1096 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1097 |
if (_hiddenPopoverController && _hiddenPopoverController.popoverVisible) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1098 |
[_hiddenPopoverController dismissPopoverAnimated:NO]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1099 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1100 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1101 |
// We don't check to see if newStyle equals _dividerStyle, because it's a meta-setting. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1102 |
// Aspects could have been changed since it was set. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1103 |
_dividerStyle = newStyle; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1104 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1105 |
// Reconfigure general appearance and behaviour. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1106 |
float cornerRadius = 0.0f; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1107 |
if (_dividerStyle == MGSplitViewDividerStyleThin) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1108 |
cornerRadius = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_7_0 ? 0 : MG_DEFAULT_CORNER_RADIUS; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1109 |
_splitWidth = MG_DEFAULT_SPLIT_WIDTH; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1110 |
self.allowsDraggingDivider = NO; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1111 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1112 |
} else if (_dividerStyle == MGSplitViewDividerStylePaneSplitter) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1113 |
cornerRadius = MG_PANESPLITTER_CORNER_RADIUS; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1114 |
_splitWidth = MG_PANESPLITTER_SPLIT_WIDTH; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1115 |
self.allowsDraggingDivider = YES; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1116 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1117 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1118 |
// Update divider and corners. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1119 |
[_dividerView setNeedsDisplay]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1120 |
if (_cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1121 |
for (MGSplitCornersView *corner in _cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1122 |
corner.cornerRadius = cornerRadius; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1123 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1124 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1125 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1126 |
// Layout all views. |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1127 |
[self layoutSubviews]; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1128 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1129 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1130 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1131 |
- (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle animated:(BOOL)animate |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1132 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1133 |
BOOL shouldAnimate = (animate && [self isShowingMaster]); |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1134 |
if (shouldAnimate) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1135 |
[UIView beginAnimations:@"DividerStyle" context:nil]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1136 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1137 |
[self setDividerStyle:newStyle]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1138 |
if (shouldAnimate) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1139 |
[UIView commitAnimations]; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1140 |
} |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1141 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1142 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1143 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1144 |
- (NSArray *)cornerViews |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1145 |
{ |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1146 |
if (_cornerViews) { |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1147 |
return _cornerViews; |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1148 |
} |
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1149 |
|
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1150 |
return nil; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1151 |
} |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1152 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1153 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1154 |
@synthesize showsMasterInPortrait; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1155 |
@synthesize showsMasterInLandscape; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1156 |
@synthesize vertical; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1157 |
@synthesize delegate; |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1158 |
@synthesize viewControllers = _viewControllers; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1159 |
@synthesize masterViewController; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1160 |
@synthesize detailViewController; |
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1161 |
@synthesize dividerView = _dividerView; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1162 |
@synthesize splitPosition; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1163 |
@synthesize splitWidth; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1164 |
@synthesize allowsDraggingDivider; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1165 |
@synthesize dividerStyle; |
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1166 |
|
11115
3729ac42189b
- MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents:
8441
diff
changeset
|
1167 |
@synthesize togglesMasterPopover; |
6658
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1168 |
|
2cccf6b2b89d
added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff
changeset
|
1169 |
@end |