Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
|
|
@ -0,0 +1,42 @@
|
|||
#import "MWMMapDownloaderPlaceTableViewCell.h"
|
||||
|
||||
#import <CoreApi/MWMMapNodeAttributes.h>
|
||||
|
||||
@interface MWMMapDownloaderPlaceTableViewCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UILabel *descriptionLabel;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint *titleBottomOffset;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMMapDownloaderPlaceTableViewCell
|
||||
|
||||
#pragma mark - Config
|
||||
|
||||
- (void)config:(MWMMapNodeAttributes *)nodeAttrs searchQuery:(NSString *)searchQuery {
|
||||
[super config:nodeAttrs searchQuery:searchQuery];
|
||||
BOOL isDescriptionVisible = NO;
|
||||
NSDictionary *selectedAreaAttrs = @{NSFontAttributeName : [UIFont bold12]};
|
||||
NSDictionary *unselectedAreaAttrs = @{NSFontAttributeName : [UIFont regular12]};
|
||||
self.needDisplayArea = !nodeAttrs.hasParent;
|
||||
if (self.needDisplayArea && nodeAttrs.topmostParentInfo.count == 1) {
|
||||
isDescriptionVisible = nodeAttrs.hasParent;
|
||||
if (isDescriptionVisible) {
|
||||
self.descriptionLabel.attributedText = [self matchedString:nodeAttrs.topmostParentInfo[0].countryName
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
}
|
||||
}
|
||||
else if (nodeAttrs.nodeDescription.length > 0)
|
||||
{
|
||||
isDescriptionVisible = YES;
|
||||
self.descriptionLabel.attributedText = [self matchedString:nodeAttrs.nodeDescription
|
||||
selectedAttrs:selectedAreaAttrs
|
||||
unselectedAttrs:unselectedAreaAttrs];
|
||||
}
|
||||
self.descriptionLabel.hidden = !isDescriptionVisible;
|
||||
self.titleBottomOffset.priority =
|
||||
isDescriptionVisible ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue