project_files/HedgewarsMobile/Classes/MGSplitViewController/MGSplitDividerView.m
author antonc27 <antonc27@mail.ru>
Sun, 20 Sep 2015 02:52:49 +0200
branchios-revival
changeset 11188 3dbea499390d
parent 11115 3729ac42189b
child 11217 e68b3e392091
permissions -rwxr-xr-x
- 'Construction Mode' ammo set and game parameters added to iOS front-end
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
//  MGSplitDividerView.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 "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
    10
#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
    11
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    13
@implementation MGSplitDividerView
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    14
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    15
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    16
#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
    17
#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
    18
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    19
2cccf6b2b89d added MGSplitViewController, popular replacement 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
- (id)initWithFrame:(CGRect)frame
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    21
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    22
	if ((self = [super initWithFrame:frame])) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    23
		self.userInteractionEnabled = NO;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    24
		self.allowsDragging = NO;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    25
		self.contentMode = UIViewContentModeRedraw;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    26
	}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    27
	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
    28
}
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement 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)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
    32
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    33
	self.splitViewController = nil;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    34
    
8441
a00b0fa0dbd7 some whitespaces from ios files
koda
parents: 6659
diff changeset
    35
    [super dealloc];
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
    36
}
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement 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
#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
    40
#pragma mark Drawing
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement 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
- (void)drawRect:(CGRect)rect
2cccf6b2b89d added MGSplitViewController, popular replacement 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
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    45
	if (splitViewController.dividerStyle == MGSplitViewDividerStyleThin) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    46
		[super drawRect:rect];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    47
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    48
	} else if (splitViewController.dividerStyle == MGSplitViewDividerStylePaneSplitter) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    49
		// Draw gradient background.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    50
		CGRect bounds = self.bounds;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    51
		CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    52
		CGFloat locations[2] = {0, 1};
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    53
		CGFloat components[8] = {	0.988f, 0.988f, 0.988f, 1.0,  // light
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    54
									0.875, 0.875, 0.875, 1.0 };// dark
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    55
		CGGradientRef gradient = CGGradientCreateWithColorComponents (rgb, components, locations, 2);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    56
		CGContextRef context = UIGraphicsGetCurrentContext();
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    57
		CGPoint start, end;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    58
		if (splitViewController.vertical) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    59
			// Light left to dark right.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    60
			start = CGPointMake(CGRectGetMinX(bounds), CGRectGetMidY(bounds));
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    61
			end = CGPointMake(CGRectGetMaxX(bounds), CGRectGetMidY(bounds));
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    62
		} else {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    63
			// Light top to dark bottom.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    64
			start = CGPointMake(CGRectGetMidX(bounds), CGRectGetMinY(bounds));
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    65
			end = CGPointMake(CGRectGetMidX(bounds), CGRectGetMaxY(bounds));
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
		CGContextDrawLinearGradient(context, gradient, start, end, 0);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    68
		CGColorSpaceRelease(rgb);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    69
		CGGradientRelease(gradient);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    70
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    71
		// Draw borders.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    72
		float borderThickness = 1.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    73
		[[UIColor colorWithWhite:0.7f alpha:1.0] set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    74
		CGRect borderRect = bounds;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    75
		if (splitViewController.vertical) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    76
			borderRect.size.width = borderThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    77
			UIRectFill(borderRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    78
			borderRect.origin.x = CGRectGetMaxX(bounds) - borderThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    79
			UIRectFill(borderRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    80
			
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    81
		} else {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    82
			borderRect.size.height = borderThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    83
			UIRectFill(borderRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    84
			borderRect.origin.y = CGRectGetMaxY(bounds) - borderThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    85
			UIRectFill(borderRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    86
		}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    87
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    88
		// Draw grip.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    89
		[self drawGripThumbInRect:bounds];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    90
	}
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
    91
}
2cccf6b2b89d added MGSplitViewController, popular replacement 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
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
    93
2cccf6b2b89d added MGSplitViewController, popular replacement 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
- (void)drawGripThumbInRect:(CGRect)rect
2cccf6b2b89d added MGSplitViewController, popular replacement 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
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    96
	float width = 9.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    97
	float height;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    98
	if (splitViewController.vertical) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
    99
		height = 30.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   100
	} else {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   101
		height = width;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   102
		width = 30.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   103
	}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   104
	
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   105
	// Draw grip in centred in rect.
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   106
	CGRect gripRect = CGRectMake(0, 0, width, height);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   107
	gripRect.origin.x = ((rect.size.width - gripRect.size.width) / 2.f);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   108
	gripRect.origin.y = ((rect.size.height - gripRect.size.height) / 2.f);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   109
	
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   110
	float stripThickness = 1.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   111
	UIColor *stripColor = [UIColor colorWithWhite:0.35f alpha:1.0];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   112
	UIColor *lightColor = [UIColor colorWithWhite:1.0 alpha:1.0];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   113
	float space = 3.0;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   114
	if (splitViewController.vertical) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   115
		gripRect.size.width = stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   116
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   117
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   118
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   119
		gripRect.origin.x += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   120
		gripRect.origin.y += 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   121
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   122
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   123
		gripRect.origin.x -= stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   124
		gripRect.origin.y -= 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   125
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   126
		gripRect.origin.x += space + stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   127
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   128
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   129
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   130
		gripRect.origin.x += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   131
		gripRect.origin.y += 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   132
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   133
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   134
		gripRect.origin.x -= stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   135
		gripRect.origin.y -= 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   136
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   137
		gripRect.origin.x += space + stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   138
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   139
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   140
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   141
		gripRect.origin.x += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   142
		gripRect.origin.y += 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   143
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   144
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   145
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   146
	} else {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   147
		gripRect.size.height = stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   148
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   149
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   150
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   151
		gripRect.origin.y += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   152
		gripRect.origin.x -= 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   153
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   154
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   155
		gripRect.origin.y -= stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   156
		gripRect.origin.x += 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   157
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   158
		gripRect.origin.y += space + stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   159
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   160
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   161
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   162
		gripRect.origin.y += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   163
		gripRect.origin.x -= 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   164
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   165
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   166
		gripRect.origin.y -= stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   167
		gripRect.origin.x += 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   168
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   169
		gripRect.origin.y += space + stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   170
		[stripColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   171
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   172
		
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   173
		gripRect.origin.y += stripThickness;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   174
		gripRect.origin.x -= 1;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   175
		[lightColor set];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   176
		UIRectFill(gripRect);
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   177
	}
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
   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
2cccf6b2b89d added MGSplitViewController, popular replacement 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
#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
   182
#pragma mark Interaction
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   183
2cccf6b2b89d added MGSplitViewController, popular replacement 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
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
2cccf6b2b89d added MGSplitViewController, popular replacement 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
	UITouch *touch = [touches anyObject];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   188
	if (touch) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   189
		CGPoint lastPt = [touch previousLocationInView:self];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   190
		CGPoint pt = [touch locationInView:self];
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   191
		float offset = (splitViewController.vertical) ? pt.x - lastPt.x : pt.y - lastPt.y;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   192
		if (!splitViewController.masterBeforeDetail) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   193
			offset = -offset;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   194
		}
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   195
		splitViewController.splitPosition = splitViewController.splitPosition + offset;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   196
	}
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
   197
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   198
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   199
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   200
#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
   201
#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
   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
- (void)setAllowsDragging:(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
   205
{
11115
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   206
	if (flag != allowsDragging) {
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   207
		allowsDragging = flag;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   208
		self.userInteractionEnabled = allowsDragging;
3729ac42189b - MGSplitViewController updated to last version with iOS 8 fixes
antonc27 <antonc27@mail.ru>
parents: 8441
diff changeset
   209
	}
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
   210
}
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   211
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   212
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   213
@synthesize splitViewController;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   214
@synthesize allowsDragging;
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   215
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   216
2cccf6b2b89d added MGSplitViewController, popular replacement for uisplitviewcontrollers: this brings rotation support to our settings pages! weapons and schemes are the only controllers displaying minor glitches
koda
parents:
diff changeset
   217
@end