forked from organicmaps/organicmaps
[ios] New search layout
This commit is contained in:
parent
51d4b17867
commit
9d166054e1
12 changed files with 222 additions and 152 deletions
11
iphone/Maps/Classes/SearchCategoryCell.h
Normal file
11
iphone/Maps/Classes/SearchCategoryCell.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
#import "SearchCell.h"
|
||||
|
||||
@interface SearchCategoryCell : SearchCell
|
||||
|
||||
@property (nonatomic, readonly) UILabel * titleLabel;
|
||||
@property (nonatomic, readonly) UIImageView * iconImageView;
|
||||
|
||||
+ (CGFloat)cellHeight;
|
||||
|
||||
@end
|
68
iphone/Maps/Classes/SearchCategoryCell.m
Normal file
68
iphone/Maps/Classes/SearchCategoryCell.m
Normal file
|
@ -0,0 +1,68 @@
|
|||
|
||||
#import "SearchCategoryCell.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface SearchCategoryCell ()
|
||||
|
||||
@property (nonatomic) UILabel * titleLabel;
|
||||
@property (nonatomic) UIImageView * iconImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SearchCategoryCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
|
||||
UIView * selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
selectedBackgroundView.backgroundColor = [UIColor colorWithColorCode:@"15d081"];
|
||||
self.selectedBackgroundView = selectedBackgroundView;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
self.titleLabel.width = self.width - self.titleLabel.minX - 20;
|
||||
|
||||
CGFloat const offsetL = 40;
|
||||
CGFloat const offsetR = 12.5;
|
||||
self.separatorView.width = self.width - offsetL - offsetR;
|
||||
self.separatorView.minX = offsetL;
|
||||
}
|
||||
|
||||
+ (CGFloat)cellHeight
|
||||
{
|
||||
return 44;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel
|
||||
{
|
||||
if (!_titleLabel)
|
||||
{
|
||||
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(44, 8, 0, 24)];
|
||||
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
_titleLabel.backgroundColor = [UIColor clearColor];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:17.5];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView
|
||||
{
|
||||
if (!_iconImageView)
|
||||
{
|
||||
_iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(13, 13, 18, 18)];
|
||||
_iconImageView.contentMode = UIViewContentModeCenter;
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
@end
|
|
@ -3,4 +3,6 @@
|
|||
|
||||
@interface SearchCell : UITableViewCell
|
||||
|
||||
@property (nonatomic) UIImageView * separatorView;
|
||||
|
||||
@end
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
#import "SearchCell.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface SearchCell ()
|
||||
|
||||
@property (nonatomic) UIImageView * separatorView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SearchCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
|
@ -18,8 +12,8 @@
|
|||
self.selectionStyle = UITableViewCellSelectionStyleDefault;
|
||||
[self addSubview:self.separatorView];
|
||||
|
||||
UIView * selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
selectedBackgroundView.backgroundColor = [UIColor colorWithColorCode:@"15d081"];
|
||||
UIImageView * selectedBackgroundView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
selectedBackgroundView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
|
||||
self.selectedBackgroundView = selectedBackgroundView;
|
||||
|
||||
return self;
|
||||
|
@ -28,10 +22,8 @@
|
|||
- (void)layoutSubviews
|
||||
{
|
||||
self.separatorView.maxY = self.height;
|
||||
CGFloat const shift = 15;
|
||||
self.separatorView.width = self.width - 2 * shift;
|
||||
self.separatorView.minX = shift;
|
||||
self.selectedBackgroundView.frame = self.bounds;
|
||||
self.backgroundView.frame = self.bounds;
|
||||
}
|
||||
|
||||
- (UIImageView *)separatorView
|
||||
|
|
|
@ -2,14 +2,13 @@
|
|||
#import <UIKit/UIKit.h>
|
||||
#import "SearchCell.h"
|
||||
|
||||
@interface SearchUniversalCell : SearchCell
|
||||
@interface SearchResultCell : SearchCell
|
||||
|
||||
@property (nonatomic, readonly) UILabel * titleLabel;
|
||||
@property (nonatomic, readonly) UILabel * typeLabel;
|
||||
@property (nonatomic, readonly) UILabel * subtitleLabel;
|
||||
@property (nonatomic, readonly) UILabel * distanceLabel;
|
||||
@property (nonatomic, readonly) UIImageView * iconImageView;
|
||||
@property (nonatomic) BOOL largeIconStyle;
|
||||
|
||||
- (void)setTitle:(NSString *)title selectedRanges:(NSArray *)selectedRanges;
|
||||
|
|
@ -1,18 +1,17 @@
|
|||
|
||||
#import "SearchUniversalCell.h"
|
||||
#import "SearchResultCell.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface SearchUniversalCell ()
|
||||
@interface SearchResultCell ()
|
||||
|
||||
@property (nonatomic) UILabel * titleLabel;
|
||||
@property (nonatomic) UILabel * typeLabel;
|
||||
@property (nonatomic) UILabel * subtitleLabel;
|
||||
@property (nonatomic) UILabel * distanceLabel;
|
||||
@property (nonatomic) UIImageView * iconImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SearchUniversalCell
|
||||
@implementation SearchResultCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
|
@ -21,9 +20,12 @@
|
|||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.typeLabel];
|
||||
[self.contentView addSubview:self.subtitleLabel];
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
[self.contentView addSubview:self.distanceLabel];
|
||||
|
||||
UIView * selectedBackgroundView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
selectedBackgroundView.backgroundColor = [UIColor colorWithColorCode:@"15d081"];
|
||||
self.selectedBackgroundView = selectedBackgroundView;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -31,8 +33,8 @@
|
|||
#define TYPE_FONT [UIFont fontWithName:@"HelveticaNeue-Light" size:12.5]
|
||||
#define TITLE_FONT [UIFont fontWithName:@"HelveticaNeue-Light" size:17]
|
||||
#define SUBTITLE_FONT [UIFont fontWithName:@"HelveticaNeue-Light" size:12.5]
|
||||
#define LEFT_SHIFT 44
|
||||
#define RIGHT_SHIFT 23
|
||||
#define LEFT_SHIFT 20
|
||||
#define RIGHT_SHIFT 20
|
||||
#define SPACE 4
|
||||
|
||||
- (void)setTitle:(NSString *)title selectedRanges:(NSArray *)selectedRanges
|
||||
|
@ -41,32 +43,13 @@
|
|||
title = @"";
|
||||
|
||||
NSMutableAttributedString * attributedTitle = [[NSMutableAttributedString alloc] initWithString:title];
|
||||
NSRange unselectedRange = NSMakeRange(0, [title length]);
|
||||
[attributedTitle addAttributes:[self unselectedTitleAttributes] range:unselectedRange];
|
||||
for (NSValue * rangeValue in selectedRanges)
|
||||
{
|
||||
NSRange range = [rangeValue rangeValue];
|
||||
[attributedTitle addAttributes:[self selectedTitleAttributes] range:range];
|
||||
}
|
||||
[attributedTitle addAttributes:[self unselectedTitleAttributes] range:NSMakeRange(0, [title length])];
|
||||
for (NSValue * range in selectedRanges)
|
||||
[attributedTitle addAttributes:[self selectedTitleAttributes] range:[range rangeValue]];
|
||||
|
||||
self.titleLabel.attributedText = attributedTitle;
|
||||
}
|
||||
|
||||
- (NSDictionary *)selectedSubtitleAttributes
|
||||
{
|
||||
static NSDictionary * selectedAttributes;
|
||||
if (!selectedAttributes)
|
||||
selectedAttributes = @{NSForegroundColorAttributeName : [UIColor colorWithColorCode:@"16b68a"], NSFontAttributeName : SUBTITLE_FONT};
|
||||
return selectedAttributes;
|
||||
}
|
||||
|
||||
- (NSDictionary *)unselectedSubtitleAttributes
|
||||
{
|
||||
static NSDictionary * unselectedAttributes;
|
||||
if (!unselectedAttributes)
|
||||
unselectedAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor], NSFontAttributeName : SUBTITLE_FONT};
|
||||
return unselectedAttributes;
|
||||
}
|
||||
|
||||
- (NSDictionary *)selectedTitleAttributes
|
||||
{
|
||||
static NSDictionary * selectedAttributes;
|
||||
|
@ -89,22 +72,24 @@
|
|||
|
||||
self.typeLabel.size = [[self class] typeSizeWithType:self.typeLabel.text];
|
||||
self.typeLabel.maxX = self.width - RIGHT_SHIFT;
|
||||
self.typeLabel.minY = 10;
|
||||
self.typeLabel.minY = 9;
|
||||
|
||||
self.distanceLabel.width = 70;
|
||||
[self.distanceLabel sizeToFit];
|
||||
self.distanceLabel.maxX = self.width - RIGHT_SHIFT;
|
||||
self.distanceLabel.maxY = self.height - 10;
|
||||
self.distanceLabel.maxY = self.height - 8.5;
|
||||
|
||||
self.titleLabel.size = [[self class] titleSizeWithTitle:self.titleLabel.text viewWidth:self.width typeSize:self.typeLabel.size];
|
||||
self.titleLabel.minX = self.largeIconStyle ? 47 : LEFT_SHIFT;
|
||||
if ([self.subtitleLabel.text length])
|
||||
self.titleLabel.minY = 5.5;
|
||||
else
|
||||
self.titleLabel.midY = self.height / 2 - 1.5;
|
||||
self.titleLabel.minX = LEFT_SHIFT;
|
||||
self.titleLabel.minY = self.typeLabel.minY - 4;
|
||||
|
||||
self.subtitleLabel.size = CGSizeMake(self.width - self.distanceLabel.width - LEFT_SHIFT - RIGHT_SHIFT - SPACE, 16);
|
||||
self.subtitleLabel.origin = CGPointMake(LEFT_SHIFT, self.titleLabel.maxY);
|
||||
self.subtitleLabel.minX = LEFT_SHIFT;
|
||||
self.subtitleLabel.maxY = self.distanceLabel.maxY;
|
||||
|
||||
CGFloat const offset = 12.5;
|
||||
self.separatorView.width = self.width - 2 * offset;
|
||||
self.separatorView.minX = offset;
|
||||
}
|
||||
|
||||
+ (CGSize)typeSizeWithType:(NSString *)type
|
||||
|
@ -176,14 +161,4 @@
|
|||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)iconImageView
|
||||
{
|
||||
if (!_iconImageView)
|
||||
{
|
||||
_iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(13.5, 12, 25, 25)];
|
||||
_iconImageView.contentMode = UIViewContentModeCenter;
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
|
||||
@end
|
10
iphone/Maps/Classes/SearchShowOnMapCell.h
Normal file
10
iphone/Maps/Classes/SearchShowOnMapCell.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
#import "SearchCell.h"
|
||||
|
||||
@interface SearchShowOnMapCell : SearchCell
|
||||
|
||||
@property (nonatomic, readonly) UILabel * titleLabel;
|
||||
|
||||
+ (CGFloat)cellHeight;
|
||||
|
||||
@end
|
52
iphone/Maps/Classes/SearchShowOnMapCell.m
Normal file
52
iphone/Maps/Classes/SearchShowOnMapCell.m
Normal file
|
@ -0,0 +1,52 @@
|
|||
|
||||
#import "SearchShowOnMapCell.h"
|
||||
#import "UIKitCategories.h"
|
||||
|
||||
@interface SearchShowOnMapCell ()
|
||||
|
||||
@property (nonatomic) UILabel * titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SearchShowOnMapCell
|
||||
|
||||
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
|
||||
UIView * backgroundView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
backgroundView.backgroundColor = [UIColor colorWithColorCode:@"1f9f7e"];
|
||||
self.backgroundView = backgroundView;
|
||||
|
||||
self.separatorView.hidden = YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
self.titleLabel.width = self.width - self.titleLabel.minX - 20;
|
||||
}
|
||||
|
||||
+ (CGFloat)cellHeight
|
||||
{
|
||||
return 44;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel
|
||||
{
|
||||
if (!_titleLabel)
|
||||
{
|
||||
_titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 8.5, 0, 24)];
|
||||
_titleLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
|
||||
_titleLabel.backgroundColor = [UIColor clearColor];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:17.5];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,18 +1,12 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "SearchCell.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SearchSuggestCellPosition)
|
||||
{
|
||||
SearchSuggestCellPositionMiddle,
|
||||
SearchSuggestCellPositionBottom
|
||||
};
|
||||
@interface SearchSuggestCell : SearchCell
|
||||
|
||||
@interface SearchSuggestCell : UITableViewCell
|
||||
|
||||
@property (nonatomic) SearchSuggestCellPosition position;
|
||||
@property (nonatomic, readonly) UILabel * titleLabel;
|
||||
@property (nonatomic, readonly) UIImageView * iconImageView;
|
||||
|
||||
+ (CGFloat)cellHeightWithPosition:(SearchSuggestCellPosition)position;
|
||||
+ (CGFloat)cellHeight;
|
||||
|
||||
@end
|
||||
|
|
|
@ -18,46 +18,27 @@
|
|||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
UIImageView * backgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
self.backgroundView = backgroundImageView;
|
||||
|
||||
UIImageView * selectedBackgroundImageView = [[UIImageView alloc] initWithFrame:self.bounds];
|
||||
self.selectedBackgroundView = selectedBackgroundImageView;
|
||||
UIView * backgroundView = [[UIView alloc] initWithFrame:self.bounds];
|
||||
backgroundView.backgroundColor = [UIColor colorWithColorCode:@"1f9f7e"];
|
||||
self.backgroundView = backgroundView;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
UIImage * image;
|
||||
UIImage * selectedImage;
|
||||
if (self.position == SearchSuggestCellPositionMiddle)
|
||||
{
|
||||
image = [UIImage imageNamed:@"SearchSuggestBackgroundMiddle"];
|
||||
selectedImage = [UIImage imageNamed:@"SearchSuggestSelectedBackgroundMiddle"];
|
||||
}
|
||||
else
|
||||
{
|
||||
image = [UIImage imageNamed:@"SearchSuggestBackgroundBottom"];
|
||||
selectedImage = [UIImage imageNamed:@"SearchSuggestSelectedBackgroundBottom"];
|
||||
}
|
||||
|
||||
UIEdgeInsets insets = UIEdgeInsetsMake(10, 40, 10, 40);
|
||||
|
||||
((UIImageView *)self.backgroundView).image = [image resizableImageWithCapInsets:insets];
|
||||
self.backgroundView.frame = self.bounds;
|
||||
|
||||
((UIImageView *)self.selectedBackgroundView).image = [selectedImage resizableImageWithCapInsets:insets];
|
||||
self.selectedBackgroundView.frame = self.bounds;
|
||||
[super layoutSubviews];
|
||||
|
||||
self.titleLabel.width = self.width - self.titleLabel.minX - 20;
|
||||
|
||||
CGFloat const offset = 12.5;
|
||||
self.separatorView.width = self.width - 2 * offset;
|
||||
self.separatorView.minX = offset;
|
||||
}
|
||||
|
||||
+ (CGFloat)cellHeightWithPosition:(SearchSuggestCellPosition)position
|
||||
+ (CGFloat)cellHeight
|
||||
{
|
||||
return position == SearchSuggestCellPositionMiddle ? 44 : 46;
|
||||
return 44;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
#import "SearchView.h"
|
||||
#import "SearchUniversalCell.h"
|
||||
#import "UIKitCategories.h"
|
||||
#import "MapsAppDelegate.h"
|
||||
#import "LocationManager.h"
|
||||
|
@ -9,6 +8,9 @@
|
|||
#import "LocationManager.h"
|
||||
#import "ToastView.h"
|
||||
#import "SearchSuggestCell.h"
|
||||
#import "SearchResultCell.h"
|
||||
#import "SearchShowOnMapCell.h"
|
||||
#import "SearchCategoryCell.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
|
@ -106,7 +108,6 @@ typedef NS_ENUM(NSUInteger, CellType)
|
|||
@property (nonatomic) UITableView * tableView;
|
||||
@property (nonatomic) SolidTouchImageView * topBackgroundView;
|
||||
@property (nonatomic) UILabel * emptyResultLabel;
|
||||
@property (nonatomic) UIImageView * suggestsTopImageView;
|
||||
|
||||
@property (nonatomic) SearchResultsWrapper * wrapper;
|
||||
@property (nonatomic) NSArray * categoriesNames;
|
||||
|
@ -140,8 +141,10 @@ __weak SearchView * selfPointer;
|
|||
selfPointer = self;
|
||||
needToScroll = NO;
|
||||
|
||||
[self.tableView registerClass:[SearchUniversalCell class] forCellReuseIdentifier:[SearchUniversalCell className]];
|
||||
[self.tableView registerClass:[SearchCategoryCell class] forCellReuseIdentifier:[SearchCategoryCell className]];
|
||||
[self.tableView registerClass:[SearchResultCell class] forCellReuseIdentifier:[SearchResultCell className]];
|
||||
[self.tableView registerClass:[SearchSuggestCell class] forCellReuseIdentifier:[SearchSuggestCell className]];
|
||||
[self.tableView registerClass:[SearchShowOnMapCell class] forCellReuseIdentifier:[SearchShowOnMapCell className]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -330,7 +333,6 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
{
|
||||
self.emptyResultLabel.hidden = [self isShowingCategories] ? YES : ([self rowsCount] > 0);
|
||||
self.wrapper = wrapper;
|
||||
self.suggestsTopImageView.hidden = ![wrapper suggestsCount];
|
||||
[self.tableView reloadData];
|
||||
[self.tableView setContentOffset:CGPointMake(0, -self.tableView.contentInset.top) animated:YES];
|
||||
}
|
||||
|
@ -379,7 +381,6 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
if ([self isShowingCategories])
|
||||
{
|
||||
[self.searchBar setSearching:NO];
|
||||
self.suggestsTopImageView.hidden = YES;
|
||||
self.emptyResultLabel.hidden = YES;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
@ -459,34 +460,25 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
{
|
||||
case CellTypeCategory:
|
||||
{
|
||||
SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]];
|
||||
SearchCategoryCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchCategoryCell className]];
|
||||
|
||||
[customCell setTitle:NSLocalizedString(self.categoriesNames[indexPath.row], nil) selectedRanges:nil];
|
||||
customCell.subtitleLabel.text = nil;
|
||||
customCell.titleLabel.text = NSLocalizedString(self.categoriesNames[indexPath.row], nil);
|
||||
NSString * iconName = [NSString stringWithFormat:@"CategoryIcon%@", [self.categoriesNames[indexPath.row] capitalizedString]];
|
||||
customCell.iconImageView.image = [UIImage imageNamed:iconName];
|
||||
customCell.distanceLabel.text = nil;
|
||||
customCell.typeLabel.text = nil;
|
||||
customCell.largeIconStyle = YES;
|
||||
cell = customCell;
|
||||
break;
|
||||
}
|
||||
case CellTypeShowOnMap:
|
||||
{
|
||||
SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]];
|
||||
SearchShowOnMapCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchShowOnMapCell className]];
|
||||
|
||||
[customCell setTitle:NSLocalizedString(@"search_on_map", nil) selectedRanges:nil];
|
||||
customCell.subtitleLabel.text = nil;
|
||||
customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinsIcon"];
|
||||
customCell.distanceLabel.text = nil;
|
||||
customCell.typeLabel.text = nil;
|
||||
customCell.largeIconStyle = NO;
|
||||
customCell.titleLabel.text = NSLocalizedString(@"search_on_map", nil);
|
||||
cell = customCell;
|
||||
break;
|
||||
}
|
||||
case CellTypeResult:
|
||||
{
|
||||
SearchUniversalCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchUniversalCell className]];
|
||||
SearchResultCell * customCell = [tableView dequeueReusableCellWithIdentifier:[SearchResultCell className]];
|
||||
|
||||
NSInteger const position = [self searchResultPositionForIndexPath:indexPath];
|
||||
search::Result const & result = [self.wrapper resultWithPosition:position];
|
||||
|
@ -503,7 +495,6 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinIcon"];
|
||||
customCell.distanceLabel.text = self.wrapper.distances[@(position)];
|
||||
customCell.typeLabel.text = [NSString stringWithUTF8String:result.GetFeatureType()];
|
||||
customCell.largeIconStyle = NO;
|
||||
cell = customCell;
|
||||
break;
|
||||
}
|
||||
|
@ -516,7 +507,6 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
|
||||
customCell.titleLabel.text = [NSString stringWithUTF8String:result.GetString()];
|
||||
customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellSpotIcon"];
|
||||
customCell.position = [self suggestPositionForIndexPath:indexPath];
|
||||
cell = customCell;
|
||||
break;
|
||||
}
|
||||
|
@ -531,11 +521,11 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
{
|
||||
case CellTypeCategory:
|
||||
{
|
||||
return [SearchUniversalCell cellHeightWithTitle:self.categoriesNames[indexPath.row] type:nil subtitle:nil distance:nil viewWidth:tableView.width];
|
||||
return [SearchCategoryCell cellHeight];
|
||||
}
|
||||
case CellTypeShowOnMap:
|
||||
{
|
||||
return [SearchUniversalCell cellHeightWithTitle:NSLocalizedString(@"search_on_map", nil) type:nil subtitle:nil distance:nil viewWidth:tableView.width];
|
||||
return [SearchShowOnMapCell cellHeight];
|
||||
}
|
||||
case CellTypeResult:
|
||||
{
|
||||
|
@ -550,11 +540,11 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
subtitle = [NSString stringWithUTF8String:result.GetRegionString()];
|
||||
type = [NSString stringWithUTF8String:result.GetFeatureType()];
|
||||
}
|
||||
return [SearchUniversalCell cellHeightWithTitle:title type:type subtitle:subtitle distance:wrapper.distances[@(position)] viewWidth:tableView.width];
|
||||
return [SearchResultCell cellHeightWithTitle:title type:type subtitle:subtitle distance:wrapper.distances[@(position)] viewWidth:tableView.width];
|
||||
}
|
||||
case CellTypeSuggest:
|
||||
{
|
||||
return [SearchSuggestCell cellHeightWithPosition:[self suggestPositionForIndexPath:indexPath]];
|
||||
return [SearchSuggestCell cellHeight];
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
@ -636,11 +626,6 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
[self.searchBar.textField resignFirstResponder];
|
||||
}
|
||||
|
||||
- (SearchSuggestCellPosition)suggestPositionForIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
return (indexPath.row == [self.wrapper suggestsCount] - 1) ? SearchSuggestCellPositionBottom : SearchSuggestCellPositionMiddle;
|
||||
}
|
||||
|
||||
- (CellType)cellTypeForIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if ([self isShowingCategories])
|
||||
|
@ -706,25 +691,10 @@ static void onSearchResultCallback(search::Results const & results)
|
|||
_tableView.dataSource = self;
|
||||
_tableView.backgroundColor = [UIColor colorWithColorCode:@"414451"];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
[_tableView addSubview:self.suggestsTopImageView];
|
||||
self.suggestsTopImageView.maxY = 0;
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (UIImageView *)suggestsTopImageView
|
||||
{
|
||||
if (!_suggestsTopImageView)
|
||||
{
|
||||
UIImage * image = [[UIImage imageNamed:@"SearchSuggestBackgroundMiddle"] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 40, 10, 40)];
|
||||
_suggestsTopImageView = [[UIImageView alloc] initWithImage:image];
|
||||
_suggestsTopImageView.frame = CGRectMake(0, 0, self.width, 600);
|
||||
_suggestsTopImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
_suggestsTopImageView.hidden = YES;
|
||||
}
|
||||
return _suggestsTopImageView;
|
||||
}
|
||||
|
||||
- (SolidTouchImageView *)topBackgroundView
|
||||
{
|
||||
if (!_topBackgroundView)
|
||||
|
|
|
@ -62,6 +62,10 @@
|
|||
978F9248183B6671000D6C7C /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 978F9246183B6671000D6C7C /* Main_iPhone.storyboard */; };
|
||||
978F9253183BD530000D6C7C /* NavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9252183BD530000D6C7C /* NavigationController.mm */; };
|
||||
978F9254183BD530000D6C7C /* NavigationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 978F9252183BD530000D6C7C /* NavigationController.mm */; };
|
||||
97908B2C19658767003DD7C6 /* SearchCategoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97908B2B19658767003DD7C6 /* SearchCategoryCell.m */; };
|
||||
97908B2D1965876C003DD7C6 /* SearchCategoryCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97908B2B19658767003DD7C6 /* SearchCategoryCell.m */; };
|
||||
97908B30196591F7003DD7C6 /* SearchShowOnMapCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97908B2F196591F7003DD7C6 /* SearchShowOnMapCell.m */; };
|
||||
97908B31196591FB003DD7C6 /* SearchShowOnMapCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97908B2F196591F7003DD7C6 /* SearchShowOnMapCell.m */; };
|
||||
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF7192F3B43009B2779 /* BottomMenu.mm */; };
|
||||
97A0EEFB192F3B43009B2779 /* BottomMenu.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF7192F3B43009B2779 /* BottomMenu.mm */; };
|
||||
97A0EEFC192F3B43009B2779 /* BottomMenuCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A0EEF9192F3B43009B2779 /* BottomMenuCell.m */; };
|
||||
|
@ -70,8 +74,8 @@
|
|||
97A8000D18B21363000C07A2 /* SearchView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000B18B21363000C07A2 /* SearchView.mm */; };
|
||||
97A8001018B21395000C07A2 /* SearchBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000F18B21395000C07A2 /* SearchBar.mm */; };
|
||||
97A8001118B21395000C07A2 /* SearchBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 97A8000F18B21395000C07A2 /* SearchBar.mm */; };
|
||||
97A8001418B2140A000C07A2 /* SearchUniversalCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8001318B2140A000C07A2 /* SearchUniversalCell.m */; };
|
||||
97A8001518B2140A000C07A2 /* SearchUniversalCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8001318B2140A000C07A2 /* SearchUniversalCell.m */; };
|
||||
97A8001418B2140A000C07A2 /* SearchResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8001318B2140A000C07A2 /* SearchResultCell.m */; };
|
||||
97A8001518B2140A000C07A2 /* SearchResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8001318B2140A000C07A2 /* SearchResultCell.m */; };
|
||||
97A8002718B2741C000C07A2 /* SearchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8002618B2741C000C07A2 /* SearchCell.m */; };
|
||||
97A8002818B2741C000C07A2 /* SearchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97A8002618B2741C000C07A2 /* SearchCell.m */; };
|
||||
97AA2821190AD21100AE1AAB /* PlacePageShareCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 97AA2820190AD21100AE1AAB /* PlacePageShareCell.m */; };
|
||||
|
@ -1382,6 +1386,10 @@
|
|||
978F9246183B6671000D6C7C /* Main_iPhone.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main_iPhone.storyboard; sourceTree = "<group>"; };
|
||||
978F9251183BD530000D6C7C /* NavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationController.h; sourceTree = "<group>"; };
|
||||
978F9252183BD530000D6C7C /* NavigationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NavigationController.mm; sourceTree = "<group>"; };
|
||||
97908B2A19658767003DD7C6 /* SearchCategoryCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchCategoryCell.h; sourceTree = "<group>"; };
|
||||
97908B2B19658767003DD7C6 /* SearchCategoryCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchCategoryCell.m; sourceTree = "<group>"; };
|
||||
97908B2E196591F7003DD7C6 /* SearchShowOnMapCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchShowOnMapCell.h; sourceTree = "<group>"; };
|
||||
97908B2F196591F7003DD7C6 /* SearchShowOnMapCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchShowOnMapCell.m; sourceTree = "<group>"; };
|
||||
97A0EEF6192F3B43009B2779 /* BottomMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomMenu.h; sourceTree = "<group>"; };
|
||||
97A0EEF7192F3B43009B2779 /* BottomMenu.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BottomMenu.mm; sourceTree = "<group>"; };
|
||||
97A0EEF8192F3B43009B2779 /* BottomMenuCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomMenuCell.h; sourceTree = "<group>"; };
|
||||
|
@ -1390,8 +1398,8 @@
|
|||
97A8000B18B21363000C07A2 /* SearchView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchView.mm; sourceTree = "<group>"; };
|
||||
97A8000E18B21395000C07A2 /* SearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchBar.h; sourceTree = "<group>"; };
|
||||
97A8000F18B21395000C07A2 /* SearchBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchBar.mm; sourceTree = "<group>"; };
|
||||
97A8001218B2140A000C07A2 /* SearchUniversalCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchUniversalCell.h; sourceTree = "<group>"; };
|
||||
97A8001318B2140A000C07A2 /* SearchUniversalCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchUniversalCell.m; sourceTree = "<group>"; };
|
||||
97A8001218B2140A000C07A2 /* SearchResultCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchResultCell.h; sourceTree = "<group>"; };
|
||||
97A8001318B2140A000C07A2 /* SearchResultCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchResultCell.m; sourceTree = "<group>"; };
|
||||
97A8002518B2741C000C07A2 /* SearchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchCell.h; sourceTree = "<group>"; };
|
||||
97A8002618B2741C000C07A2 /* SearchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchCell.m; sourceTree = "<group>"; };
|
||||
97AA281F190AD21100AE1AAB /* PlacePageShareCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlacePageShareCell.h; sourceTree = "<group>"; };
|
||||
|
@ -2372,10 +2380,14 @@
|
|||
97A8000F18B21395000C07A2 /* SearchBar.mm */,
|
||||
97A8002518B2741C000C07A2 /* SearchCell.h */,
|
||||
97A8002618B2741C000C07A2 /* SearchCell.m */,
|
||||
97A8001218B2140A000C07A2 /* SearchUniversalCell.h */,
|
||||
97A8001318B2140A000C07A2 /* SearchUniversalCell.m */,
|
||||
97A8001218B2140A000C07A2 /* SearchResultCell.h */,
|
||||
97A8001318B2140A000C07A2 /* SearchResultCell.m */,
|
||||
97CC93B919599F4700369B42 /* SearchSuggestCell.h */,
|
||||
97CC93BA19599F4700369B42 /* SearchSuggestCell.m */,
|
||||
97908B2A19658767003DD7C6 /* SearchCategoryCell.h */,
|
||||
97908B2B19658767003DD7C6 /* SearchCategoryCell.m */,
|
||||
97908B2E196591F7003DD7C6 /* SearchShowOnMapCell.h */,
|
||||
97908B2F196591F7003DD7C6 /* SearchShowOnMapCell.m */,
|
||||
);
|
||||
name = Search;
|
||||
sourceTree = "<group>";
|
||||
|
@ -4404,6 +4416,7 @@
|
|||
1D60589B0D05DD56006BFB54 /* main.mm in Sources */,
|
||||
97A0EEFA192F3B43009B2779 /* BottomMenu.mm in Sources */,
|
||||
9747278418338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
|
||||
97908B30196591F7003DD7C6 /* SearchShowOnMapCell.m in Sources */,
|
||||
1D3623260D0F684500981E51 /* MapsAppDelegate.mm in Sources */,
|
||||
9746492718EEE2F8004B4658 /* ToolbarView.m in Sources */,
|
||||
46F26CD810F623BA00ECCA39 /* EAGLView.mm in Sources */,
|
||||
|
@ -4422,8 +4435,9 @@
|
|||
9747264318323080006B7CB7 /* UIKitCategories.m in Sources */,
|
||||
97A0EEFC192F3B43009B2779 /* BottomMenuCell.m in Sources */,
|
||||
97D092B9190AA69700FF645B /* SmallCompassView.mm in Sources */,
|
||||
97A8001418B2140A000C07A2 /* SearchUniversalCell.m in Sources */,
|
||||
97A8001418B2140A000C07A2 /* SearchResultCell.m in Sources */,
|
||||
97A8002718B2741C000C07A2 /* SearchCell.m in Sources */,
|
||||
97908B2C19658767003DD7C6 /* SearchCategoryCell.m in Sources */,
|
||||
9778E9A5191A86D800AD850A /* SelectedColorView.m in Sources */,
|
||||
97D807B818A92AAB00D416E0 /* MoreAppsVC.mm in Sources */,
|
||||
9789DB5A188D94F9007C6FAE /* InterstitialView.mm in Sources */,
|
||||
|
@ -4470,6 +4484,7 @@
|
|||
FAFB08E9151215EE0041901D /* main.mm in Sources */,
|
||||
9747278518338F0C006B7CB7 /* UIViewController+Navigation.m in Sources */,
|
||||
FAFB08EA151215EE0041901D /* MapsAppDelegate.mm in Sources */,
|
||||
97908B31196591FB003DD7C6 /* SearchShowOnMapCell.m in Sources */,
|
||||
FAFB08EB151215EE0041901D /* EAGLView.mm in Sources */,
|
||||
97A8001118B21395000C07A2 /* SearchBar.mm in Sources */,
|
||||
FAFB08EC151215EE0041901D /* MapViewController.mm in Sources */,
|
||||
|
@ -4490,12 +4505,13 @@
|
|||
9747264418323080006B7CB7 /* UIKitCategories.m in Sources */,
|
||||
FAFB08F5151215EE0041901D /* Preferences.mm in Sources */,
|
||||
97D807BD18A933FB00D416E0 /* MoreAppsCell.m in Sources */,
|
||||
97908B2D1965876C003DD7C6 /* SearchCategoryCell.m in Sources */,
|
||||
FAFB08F6151215EE0041901D /* LocationManager.mm in Sources */,
|
||||
9789DB57188D5E2A007C6FAE /* InAppMessagesManager.mm in Sources */,
|
||||
97AA2822190AD21100AE1AAB /* PlacePageShareCell.m in Sources */,
|
||||
97D092BA190AA69700FF645B /* SmallCompassView.mm in Sources */,
|
||||
978F9241183B660F000D6C7C /* SettingsViewController.mm in Sources */,
|
||||
97A8001518B2140A000C07A2 /* SearchUniversalCell.m in Sources */,
|
||||
97A8001518B2140A000C07A2 /* SearchResultCell.m in Sources */,
|
||||
F7B90CD41521E6D200C054EE /* CustomNavigationView.mm in Sources */,
|
||||
9778E9A2191A663700AD850A /* BookmarkNameVC.mm in Sources */,
|
||||
FA36B80E15403A4F004560CC /* BookmarksVC.mm in Sources */,
|
||||
|
|
Loading…
Add table
Reference in a new issue