mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-06 12:34:24 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
81
iphone/Maps/UI/Downloader/NoMaps/MWMNoMapsView.m
Normal file
81
iphone/Maps/UI/Downloader/NoMaps/MWMNoMapsView.m
Normal file
@@ -0,0 +1,81 @@
|
||||
#import "MWMNoMapsView.h"
|
||||
#import "MWMKeyboard.h"
|
||||
|
||||
@interface MWMNoMapsView ()<MWMKeyboardObserver>
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UIImageView * image;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * title;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * text;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerWidth;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerHeight;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerTopOffset;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * containerBottomOffset;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageMinHeight;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageHeight;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleImageOffset;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * titleTopOffset;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * textTopOffset;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMNoMapsView
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
if (!IPAD)
|
||||
{
|
||||
self.containerWidth.active = NO;
|
||||
self.containerHeight.active = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.containerTopOffset.active = NO;
|
||||
}
|
||||
[MWMKeyboard addObserver:self];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
[self configForSize:self.frame.size];
|
||||
}
|
||||
|
||||
- (void)configForSize:(CGSize)size
|
||||
{
|
||||
CGSize iPadSize = CGSizeMake(520, 600);
|
||||
CGSize newSize = IPAD ? iPadSize : size;
|
||||
CGFloat width = newSize.width;
|
||||
CGFloat height = newSize.height;
|
||||
BOOL hideImage = (self.imageHeight.multiplier * height <= self.imageMinHeight.constant);
|
||||
if (hideImage)
|
||||
{
|
||||
self.titleImageOffset.priority = UILayoutPriorityDefaultLow;
|
||||
self.title.hidden = self.title.minY < self.titleTopOffset.constant;
|
||||
self.text.hidden = self.text.minY < self.textTopOffset.constant;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.titleImageOffset.priority = UILayoutPriorityDefaultHigh;
|
||||
self.title.hidden = NO;
|
||||
self.text.hidden = NO;
|
||||
}
|
||||
self.image.hidden = hideImage;
|
||||
if (IPAD)
|
||||
{
|
||||
self.containerWidth.constant = width;
|
||||
self.containerHeight.constant = height;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - MWMKeyboard
|
||||
|
||||
- (void)onKeyboardAnimation
|
||||
{
|
||||
self.containerBottomOffset.constant = [MWMKeyboard keyboardHeight];
|
||||
[self.superview layoutIfNeeded];
|
||||
}
|
||||
|
||||
- (void)onKeyboardWillAnimate { [self.superview layoutIfNeeded]; }
|
||||
@end
|
||||
Reference in New Issue
Block a user