Permalink
Browse files

Update for ARC.

  • Loading branch information...
1 parent c390133 commit bc09490ba36fc2e707eaaacb3a5eef5ec98c12e9 @mbaltaks committed Nov 22, 2012
Showing with 23 additions and 41 deletions.
  1. +16 −19 Classes/MGSplitCornersView.m
  2. +0 −1 Classes/MGSplitDividerView.m
  3. +7 −21 Classes/MGSplitViewController.m
@@ -26,15 +26,13 @@ - (id)initWithFrame:(CGRect)frame
cornerRadius = 0.0; // actual value is set by the splitViewController.
cornersPosition = MGCornersPositionLeadingVertical;
}
-
+
return self;
}
- (void)dealloc
{
-
- [super dealloc];
cornerBackgroundColor_ = nil;
}
@@ -81,7 +79,7 @@ - (void)drawRect:(CGRect)rect
[[UIColor redColor] set];
UIRectFill(self.bounds);
}
-
+
float maxX = CGRectGetMaxX(self.bounds);
float maxY = CGRectGetMaxY(self.bounds);
UIBezierPath *path = [UIBezierPath bezierPath];
@@ -96,7 +94,7 @@ - (void)drawRect:(CGRect)rect
[path addLineToPoint:pt];
[path addLineToPoint:CGPointZero];
[path closePath];
-
+
pt.x = maxX - cornerRadius;
pt.y = 0;
[path moveToPoint:pt];
@@ -109,9 +107,9 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
break;
-
+
case MGCornersPositionTrailingVertical: // bottom of screen for a left/right split
pt.y = maxY;
[path moveToPoint:pt];
@@ -123,7 +121,7 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
pt.x = maxX - cornerRadius;
pt.y = maxY;
[path moveToPoint:pt];
@@ -136,9 +134,9 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
break;
-
+
case MGCornersPositionLeadingHorizontal: // left of screen for a top/bottom split
pt.x = 0;
pt.y = cornerRadius;
@@ -152,7 +150,7 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
pt.x = 0;
pt.y = maxY - cornerRadius;
[path moveToPoint:pt];
@@ -165,9 +163,9 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
break;
-
+
case MGCornersPositionTrailingHorizontal: // right of screen for a top/bottom split
pt.y = cornerRadius;
[path moveToPoint:pt];
@@ -179,7 +177,7 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
pt.y = maxY - cornerRadius;
[path moveToPoint:pt];
pt.y += cornerRadius;
@@ -190,13 +188,13 @@ - (void)drawRect:(CGRect)rect
pt.x -= cornerRadius;
[path addLineToPoint:pt];
[path closePath];
-
+
break;
-
+
default:
break;
}
-
+
[self.cornerBackgroundColor set];
[path fill];
}
@@ -238,8 +236,7 @@ - (void)setCornersPosition:(MGCornersPosition)posn
- (void)setCornerBackgroundColor:(UIColor *)color
{
if (color != cornerBackgroundColor_) {
- [cornerBackgroundColor_ release];
- cornerBackgroundColor_ = [color retain];
+ cornerBackgroundColor_ = color;
[self setNeedsDisplay];
}
}
@@ -30,7 +30,6 @@ - (id)initWithFrame:(CGRect)frame
- (void)dealloc
{
- [super dealloc];
splitViewController_ = nil;
}
@@ -149,13 +149,6 @@ - (void)dealloc
{
_delegate = nil;
[self.view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
- [_viewControllers release];
- [_barButtonItem release];
- [_hiddenPopoverController release];
- [_dividerView release];
- [_cornerViews release];
-
- [super dealloc];
}
@@ -437,9 +430,7 @@ - (void)layoutSubviewsForInterfaceOrientation:(UIInterfaceOrientation)theOrienta
trailingCorners.cornerBackgroundColor = MG_DEFAULT_CORNER_COLOR;
trailingCorners.cornerRadius = MG_DEFAULT_CORNER_RADIUS;
_cornerViews = [[NSArray alloc] initWithObjects:leadingCorners, trailingCorners, nil];
- [leadingCorners release];
- [trailingCorners release];
-
+
} else if ([_cornerViews count] == 2) {
leadingCorners = [_cornerViews objectAtIndex:0];
trailingCorners = [_cornerViews objectAtIndex:1];
@@ -559,7 +550,6 @@ - (void)reconfigureForMasterInPopover:(BOOL)inPopover
if (inPopover && !_hiddenPopoverController && !_barButtonItem) {
// Create and configure popover for our masterViewController.
- [_hiddenPopoverController release];
_hiddenPopoverController = nil;
[self.masterViewController viewWillDisappear:NO];
_hiddenPopoverController = [[UIPopoverController alloc] initWithContentViewController:self.masterViewController];
@@ -585,7 +575,6 @@ - (void)reconfigureForMasterInPopover:(BOOL)inPopover
// Remove master from popover and destroy popover, if it exists.
[_hiddenPopoverController dismissPopoverAnimated:NO];
- [_hiddenPopoverController release];
_hiddenPopoverController = nil;
// Inform delegate that the _barButtonItem will become invalid.
@@ -596,7 +585,6 @@ - (void)reconfigureForMasterInPopover:(BOOL)inPopover
}
// Destroy _barButtonItem.
- [_barButtonItem release];
_barButtonItem = nil;
// Move master view.
@@ -911,7 +899,7 @@ - (void)setSplitWidth:(float)width
- (NSArray *)viewControllers
{
- return [[_viewControllers copy] autorelease];
+ return [_viewControllers copy];
}
@@ -923,7 +911,6 @@ - (void)setViewControllers:(NSArray *)controllers
[controller.view removeFromSuperview];
}
}
- [_viewControllers release];
_viewControllers = [[NSMutableArray alloc] initWithCapacity:2];
if (controllers && [controllers count] >= 2) {
self.masterViewController = [controllers objectAtIndex:0];
@@ -942,7 +929,7 @@ - (UIViewController *)masterViewController
if (_viewControllers && [_viewControllers count] > 0) {
NSObject *controller = [_viewControllers objectAtIndex:0];
if ([controller isKindOfClass:[UIViewController class]]) {
- return [[controller retain] autorelease];
+ return (UIViewController *)controller;
}
}
@@ -984,7 +971,7 @@ - (UIViewController *)detailViewController
if (_viewControllers && [_viewControllers count] > 1) {
NSObject *controller = [_viewControllers objectAtIndex:1];
if ([controller isKindOfClass:[UIViewController class]]) {
- return [[controller retain] autorelease];
+ return (UIViewController *)controller;
}
}
@@ -1020,16 +1007,15 @@ - (void)setDetailViewController:(UIViewController *)detail
- (MGSplitDividerView *)dividerView
{
- return [[_dividerView retain] autorelease];
+ return _dividerView;
}
- (void)setDividerView:(MGSplitDividerView *)divider
{
if (divider != _dividerView) {
[_dividerView removeFromSuperview];
- [_dividerView release];
- _dividerView = [divider retain];
+ _dividerView = divider;
_dividerView.splitViewController = self;
_dividerView.backgroundColor = MG_DEFAULT_CORNER_COLOR;
if ([self isShowingMaster]) {
@@ -1114,7 +1100,7 @@ - (void)setDividerStyle:(MGSplitViewDividerStyle)newStyle animated:(BOOL)animate
- (NSArray *)cornerViews
{
if (_cornerViews) {
- return [[_cornerViews retain] autorelease];
+ return _cornerViews;
}
return nil;

0 comments on commit bc09490

Please sign in to comment.