Convenience methods for anchoring without callbacks

- Instead of calling anchorTopView:animations:onComplete: with nil blocks, you can just call anchorTopView:
This commit is contained in:
Mike Enriquez
2012-03-20 14:30:53 -04:00
parent d9ce954746
commit e5d6981343
6 changed files with 31 additions and 7 deletions

View File

@@ -46,12 +46,12 @@
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECRight animations:nil onComplete:nil];
[self.slidingViewController anchorTopViewTo:ECRight];
}
- (IBAction)revealUnderRight:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECLeft animations:nil onComplete:nil];
[self.slidingViewController anchorTopViewTo:ECLeft];
}
@end

View File

@@ -40,7 +40,7 @@
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECRight animations:nil onComplete:nil];
[self.slidingViewController anchorTopViewTo:ECRight];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

View File

@@ -26,7 +26,7 @@
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECRight animations:nil onComplete:nil];
[self.slidingViewController anchorTopViewTo:ECRight];
}
@end

View File

@@ -53,7 +53,7 @@
- (IBAction)revealMenu:(id)sender
{
[self.slidingViewController anchorTopViewTo:ECRight animations:nil onComplete:nil];
[self.slidingViewController anchorTopViewTo:ECRight];
}
// slidingViewController notification

View File

@@ -118,6 +118,14 @@ typedef enum {
*/
- (UIPanGestureRecognizer *)panGesture;
/** Slides the top view in the direction of the specified side.
A peek amount or reveal amount must be set for the given side. The top view will anchor to one of those specified values.
@param side The side for the top view to slide towards.
*/
- (void)anchorTopViewTo:(ECSide)side;
/** Slides the top view in the direction of the specified side.
A peek amount or reveal amount must be set for the given side. The top view will anchor to one of those specified values.
@@ -128,6 +136,12 @@ typedef enum {
*/
- (void)anchorTopViewTo:(ECSide)side animations:(void(^)())animations onComplete:(void(^)())complete;
/** Slides the top view off of the screen in the direction of the specified side.
@param side The side for the top view to slide off the screen towards.
*/
- (void)anchorTopViewOffScreenTo:(ECSide)side;
/** Slides the top view off of the screen in the direction of the specified side.
@param side The side for the top view to slide off the screen towards.

View File

@@ -185,9 +185,9 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
CGFloat currentVelocityX = currentVelocityPoint.x;
if ([self underLeftShowing] && currentVelocityX > 100) {
[self anchorTopViewTo:ECRight animations:nil onComplete:nil];
[self anchorTopViewTo:ECRight];
} else if ([self underRightShowing] && currentVelocityX < 100) {
[self anchorTopViewTo:ECLeft animations:nil onComplete:nil];
[self anchorTopViewTo:ECLeft];
} else {
[self resetTopView];
}
@@ -199,6 +199,11 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
return _panGesture;
}
- (void)anchorTopViewTo:(ECSide)side
{
[self anchorTopViewTo:side animations:nil onComplete:nil];
}
- (void)anchorTopViewTo:(ECSide)side animations:(void (^)())animations onComplete:(void (^)())complete
{
CGFloat newCenter = self.topView.center.x;
@@ -234,6 +239,11 @@ NSString *const ECSlidingViewTopDidReset = @"ECSlidingViewTopDidReset";
}];
}
- (void)anchorTopViewOffScreenTo:(ECSide)side
{
[self anchorTopViewOffScreenTo:side animations:nil onComplete:nil];
}
- (void)anchorTopViewOffScreenTo:(ECSide)side animations:(void(^)())animations onComplete:(void(^)())complete
{
CGFloat newCenter = self.topView.center.x;