[ios] Fixed PP crash on swipe.

This commit is contained in:
Ilya Grechuhin 2015-06-24 17:32:27 +03:00 committed by Alex Zolotarev
parent 090ba97c56
commit 226c68fbf6
3 changed files with 12 additions and 7 deletions

View file

@ -15,6 +15,7 @@
@property (weak, nonatomic) IBOutlet MWMBasePlacePageView * basePlacePageView;
@property (weak, nonatomic) IBOutlet UIView * extendedPlacePageView;
@property (weak, nonatomic) IBOutlet UIImageView * anchorImageView;
@property (weak, nonatomic) IBOutlet UIPanGestureRecognizer * panRecognizer;
@property (weak, nonatomic, readonly) MWMPlacePageViewManager * manager;
@property (nonatomic) MWMPlacePageActionBar * actionBar;
@property (nonatomic) CGFloat topBound;

View file

@ -59,12 +59,6 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
self.state = MWMiPhoneLandscapePlacePageStateClosed;
}
- (void)setState:(MWMiPhoneLandscapePlacePageState)state
{
_state = state;
[self updateTargetPoint];
}
- (void)updateTargetPoint
{
CGSize const size = UIScreen.mainScreen.bounds.size;
@ -94,9 +88,10 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
UIGestureRecognizerState const state = sender.state;
if (state == UIGestureRecognizerStateEnded || state == UIGestureRecognizerStateCancelled)
{
sender.enabled = NO;
self.panVelocity = [sender velocityInView:ppvSuper].x;
if (self.panVelocity > 0)
self.state = MWMiPhoneLandscapePlacePageStateOpen;
[self show];
else
[self.manager dismissPlacePage];
}
@ -129,6 +124,12 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
#pragma mark - Properties
- (void)setState:(MWMiPhoneLandscapePlacePageState)state
{
_state = state;
[self updateTargetPoint];
}
- (void)setTopBound:(CGFloat)topBound
{
super.topBound = topBound;
@ -151,6 +152,8 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
__strong MWMiPhoneLandscapePlacePage * self = weakSelf;
if (self.state == MWMiPhoneLandscapePlacePageStateClosed)
[super dismiss];
else
self.panRecognizer.enabled = YES;
}];
self.panVelocity = 0.0;
}

View file

@ -10,6 +10,7 @@
<outlet property="anchorImageView" destination="a4c-bA-qa5" id="XxC-0s-K2B"/>
<outlet property="basePlacePageView" destination="8RI-YR-2UD" id="B5i-Do-Hos"/>
<outlet property="extendedPlacePageView" destination="KWK-Ky-ZkL" id="rlo-FR-5wm"/>
<outlet property="panRecognizer" destination="elN-ZP-7aG" id="LmJ-8k-oOP"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>