forked from organicmaps/organicmaps
[bookmarks][iOS] Review fixes.
This commit is contained in:
parent
4f99193263
commit
44b95fbfb4
6 changed files with 27 additions and 19 deletions
|
@ -51,6 +51,10 @@ CGFloat const kPinDiameter = 22.0f;
|
|||
return self.isEditable;
|
||||
}
|
||||
|
||||
- (BOOL)canSelect {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)fillCell:(UITableViewCell *)cell
|
||||
withBookmarkDetails:(Bookmark const *)bookmark
|
||||
andLocation:(CLLocation *)location {
|
||||
|
@ -104,13 +108,12 @@ CGFloat const kPinDiameter = 22.0f;
|
|||
[self fillCell:cell withBookmarkDetails:bookmark andLocation:location];
|
||||
}
|
||||
|
||||
- (BOOL)didSelectRow:(NSInteger)row {
|
||||
- (void)didSelectRow:(NSInteger)row {
|
||||
auto const bmId = [self markIdForRow:row];
|
||||
[Statistics logEvent:kStatEventName(kStatBookmarks, kStatShowOnMap)];
|
||||
// Same as "Close".
|
||||
[MWMSearchManager manager].state = MWMSearchManagerStateHidden;
|
||||
GetFramework().ShowBookmark(bmId);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)deleteRow:(NSInteger)row {
|
||||
|
|
|
@ -667,16 +667,18 @@ using namespace std;
|
|||
return cell;
|
||||
}
|
||||
|
||||
- (nullable NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if ([[self currentSections][indexPath.section] canSelect])
|
||||
return indexPath;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// Remove cell selection
|
||||
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
auto const close = [[self currentSections][indexPath.section] didSelectRow:indexPath.row];
|
||||
|
||||
[[self currentSections][indexPath.section] didSelectRow:indexPath.row];
|
||||
[self.searchBar resignFirstResponder];
|
||||
|
||||
if (close)
|
||||
[self.navigationController popToRootViewControllerAnimated:NO];
|
||||
[self.navigationController popToRootViewControllerAnimated:NO];
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)canSelect {
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow:(NSInteger)row {
|
||||
if (self.infoCell != nil)
|
||||
return self.infoCell;
|
||||
|
@ -58,8 +62,7 @@
|
|||
return cell;
|
||||
}
|
||||
|
||||
- (BOOL)didSelectRow:(NSInteger)row {
|
||||
return NO;
|
||||
- (void)didSelectRow:(NSInteger)row {
|
||||
}
|
||||
|
||||
- (void)deleteRow:(NSInteger)row {
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
#include "kml/types.hpp"
|
||||
#include "kml/type_utils.hpp"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface MWMCategoryInfoCell()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * titleLabel;
|
||||
|
@ -17,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * infoToBottomConstraint;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint * infoHeightConstraint;
|
||||
|
||||
@property(copy, nonatomic, nullable) NSAttributedString *info;
|
||||
@property(copy, nonatomic, nullable) NSString *shortInfo;
|
||||
@property(copy, nonatomic) NSAttributedString *info;
|
||||
@property(copy, nonatomic) NSString *shortInfo;
|
||||
@property (weak, nonatomic) id<MWMCategoryInfoCellDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
@ -99,5 +97,3 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -7,10 +7,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (NSInteger)numberOfRows;
|
||||
- (nullable NSString *)title;
|
||||
- (BOOL)canEdit;
|
||||
- (BOOL)canSelect;
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow:(NSInteger)row;
|
||||
|
||||
- (BOOL)didSelectRow:(NSInteger)row;
|
||||
- (void)didSelectRow:(NSInteger)row;
|
||||
- (void)deleteRow:(NSInteger)row;
|
||||
|
||||
@optional
|
||||
|
|
|
@ -45,6 +45,10 @@ CGFloat const kPinDiameter = 22.0f;
|
|||
return self.isEditable;
|
||||
}
|
||||
|
||||
- (BOOL)canSelect {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow:(NSInteger)row {
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TrackCell"];
|
||||
if (!cell)
|
||||
|
@ -70,10 +74,9 @@ CGFloat const kPinDiameter = 22.0f;
|
|||
return cell;
|
||||
}
|
||||
|
||||
- (BOOL)didSelectRow:(NSInteger)row {
|
||||
- (void)didSelectRow:(NSInteger)row {
|
||||
auto const trackId = [self trackIdForRow:row];
|
||||
GetFramework().ShowTrack(trackId);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)deleteRow:(NSInteger)row {
|
||||
|
|
Loading…
Add table
Reference in a new issue