[ios] Fixed iPad layout bugs.

This commit is contained in:
v.mikhaylenko 2015-06-24 20:00:19 +03:00 committed by Alex Zolotarev
parent 0adffd4fe8
commit 34b7fe425e
7 changed files with 40 additions and 29 deletions

View file

@ -98,7 +98,6 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
return;
self.iPadOwnerNavigationController.navigationBar.hidden = YES;
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
}
- (void)setState:(BookmarkDescriptionState)state
@ -172,7 +171,7 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
if (self.manager.entity.isHTMLDescription)
self.state = BookmarkDescriptionStateViewHTML;
else
[self.navigationController popViewControllerAnimated:YES];
[self popViewController];
}
- (void)doneTap
@ -185,12 +184,12 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
if (entity.isHTMLDescription)
self.state = BookmarkDescriptionStateViewHTML;
else
[self.navigationController popViewControllerAnimated:YES];
[self popViewController];
}
- (void)backTap
{
[self.navigationController popViewControllerAnimated:YES];
[self popViewController];
}
- (void)editTap
@ -198,6 +197,24 @@ typedef NS_ENUM(NSUInteger, BookmarkDescriptionState)
self.state = BookmarkDescriptionStateEditHTML;
}
- (void)popViewController
{
if (!self.iPadOwnerNavigationController)
{
[self.navigationController popViewControllerAnimated:YES];
return;
}
[UIView animateWithDuration:0.1 animations:^
{
self.iPadOwnerNavigationController.view.height = self.realPlacePageHeight;
}
completion:^(BOOL finished)
{
[self.navigationController popViewControllerAnimated:YES];
}];
}
#pragma mark - Notifications
- (void)keyboardWillShown:(NSNotification *)aNotification

View file

@ -38,6 +38,7 @@
- (void)reloadBookmark;
- (void)willStartEditingBookmarkTitle:(CGFloat)keyboardHeight;
- (void)willFinishEditingBookmarkTitle:(NSString *)title;
- (void)addPlacePageShadowToView:(UIView *)view;
- (IBAction)didTap:(UITapGestureRecognizer *)sender;

View file

@ -98,6 +98,18 @@ extern NSString * const kAlohalyticsTapEventKey;
[self.actionBar dismissActivityIndicatior];
}
- (void)addPlacePageShadowToView:(UIView *)view
{
CALayer * layer = view.layer;
layer.masksToBounds = NO;
layer.shadowColor = UIColor.blackColor.CGColor;
layer.shadowRadius = 4.;
layer.shadowOpacity = 0.24f;
layer.shadowOffset = CGSizeMake(0., - 2.);
layer.shouldRasterize = YES;
layer.rasterizationScale = [[UIScreen mainScreen] scale];
}
- (void)setDirectionArrowTransform:(CGAffineTransform)transform
{
self.basePlacePageView.directionArrow.transform = transform;

View file

@ -124,10 +124,4 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
self.indicatior = nil;
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// Prevent super call to stop event propagation
// [super touchesBegan:touches withEvent:event];
}
@end

View file

@ -181,7 +181,9 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
ShareInfo * info = [[ShareInfo alloc] initWithText:entity.title gX:entity.point.x gY:entity.point.y myPosition:NO];
self.actionSheet = [[ShareActionSheet alloc] initWithInfo:info viewController:self.ownerViewController];
[self.actionSheet showFromRect:CGRectNull];
UIView * parentView = self.ownerViewController.view;
CGRect rect = CGRectMake(parentView.midX, parentView.height - 40.0, 0.0, 0.0);
[self.actionSheet showFromRect:rect];
}
- (void)addBookmark

View file

@ -57,7 +57,6 @@ static CGFloat const kBottomOffset = 12.;
[self setNavigationBarHidden:YES];
[self.navigationBar setTranslucent:NO];
self.view.autoresizingMask = UIViewAutoresizingNone;
[self configureShadow];
return self;
}
@ -66,17 +65,6 @@ static CGFloat const kBottomOffset = 12.;
[self popViewControllerAnimated:YES];
}
- (void)configureShadow
{
CALayer * layer = self.view.layer;
layer.masksToBounds = NO;
layer.shadowColor = UIColor.blackColor.CGColor;
layer.shadowRadius = 4.;
layer.shadowOpacity = 0.24f;
layer.shadowOffset = CGSizeMake(0., - 2.);
layer.shouldRasterize = YES;
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
viewController.view.frame = self.view.bounds;
@ -87,7 +75,7 @@ static CGFloat const kBottomOffset = 12.;
@interface MWMiPadPlacePage ()
@property (strong, nonatomic) MWMiPadNavigationController * navigationController;
@property (nonatomic) MWMiPadNavigationController * navigationController;
@property (nonatomic) CGFloat height;
@end
@ -100,6 +88,7 @@ static CGFloat const kBottomOffset = 12.;
CGFloat const defaultWidth = 360.;
[self updatePlacePageLayout];
[self addPlacePageShadowToView:self.navigationController.view];
[self.manager addSubviews:@[self.navigationController.view] withNavigationController:self.navigationController];
self.navigationController.view.frame = CGRectMake( -defaultWidth, self.topBound + kTopOffset, defaultWidth, self.height);

View file

@ -41,6 +41,7 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
self.anchorImageView.backgroundColor = [UIColor whiteColor];
self.anchorImageView.image = nil;
[self configureContentInset];
[self addPlacePageShadowToView:self.extendedPlacePageView];
[self.extendedPlacePageView addSubview:self.actionBar];
[self.manager addSubviews:@[self.extendedPlacePageView] withNavigationController:nil];
}
@ -50,11 +51,6 @@ typedef NS_ENUM(NSUInteger, MWMiPhoneLandscapePlacePageState)
self.state = MWMiPhoneLandscapePlacePageStateOpen;
}
- (void)dismiss
{
self.state = MWMiPhoneLandscapePlacePageStateClosed;
}
- (void)configureContentInset
{
CGFloat const height = self.extendedPlacePageView.height - self.anchorImageView.height;