[ios] Refactored cuisine displaying in place page.

This commit is contained in:
VladiMihaylenko 2016-02-10 16:11:57 +03:00 committed by Sergey Yershov
parent a346495efb
commit 3637bef619
2 changed files with 15 additions and 2 deletions

View file

@ -13,6 +13,8 @@
extern CGFloat const kBottomPlacePageOffset = 15.;
extern CGFloat const kLabelsBetweenOffset = 8.;
extern NSString * const kMWMCuisineSeparator;
namespace
{
CGFloat const kLeftOffset = 16.;
@ -106,7 +108,18 @@ enum class AttributePosition
else
{
self.titleLabel.text = entity.title;
self.typeLabel.text = [entity.category capitalizedString];
NSString * typeString = entity.category.capitalizedString;
NSRange const range = [typeString rangeOfString:kMWMCuisineSeparator];
if (range.location != NSNotFound)
{
NSMutableAttributedString * str = [[NSMutableAttributedString alloc] initWithString:typeString];
[str addAttributes:@{NSForegroundColorAttributeName : [UIColor blackHintText]} range:range];
self.typeLabel.attributedText = str;
}
else
{
self.typeLabel.text = typeString;
}
}
[self.typeDescriptionView removeFromSuperview];

View file

@ -8,12 +8,12 @@
using feature::Metadata;
extern NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
extern NSString * const kMWMCuisineSeparator = @" • ";
namespace
{
NSString * const kOSMCuisineSeparator = @";";
NSString * const kMWMCuisineSeparator = @" • ";
NSString * makeOSMCuisineString(NSSet<NSString *> * cuisines)
{