Fixed bug with wrong selection on maps downloader screen.

This commit is contained in:
Timur Bernikowich 2014-10-22 21:52:24 +03:00 committed by Alex Zolotarev
parent da1e2b9dee
commit cfc987c24a
3 changed files with 22 additions and 9 deletions

View file

@ -266,6 +266,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ([self isActiveMapsIndexPath:indexPath])
{
ActiveMapsVC * vc = [[ActiveMapsVC alloc] init];
@ -279,8 +280,6 @@
MapCell * cell = [self cellAtPositionInNode:self.selectedPosition];
UIActionSheet * actionSheet = [self actionSheetToPerformActionOnSelectedMap];
[actionSheet showFromRect:cell.frame inView:cell.superview animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
else
{

View file

@ -23,7 +23,7 @@ typedef NS_ENUM(NSUInteger, DownloaderAction)
using namespace storage;
@interface DownloaderParentVC : UITableViewController <MapCellDelegate, UIActionSheetDelegate, UIAlertViewDelegate>
@interface DownloaderParentVC : UIViewController <MapCellDelegate, UIActionSheetDelegate, UIAlertViewDelegate, UITableViewDataSource, UITableViewDelegate>
- (NSString *)formattedMapSize:(size_t)size;
- (void)openGuideWithInfo:(guides::GuideInfo const &)info;
@ -32,6 +32,8 @@ using namespace storage;
- (UIActionSheet *)actionSheetToCancelDownloadingSelectedMap;
- (UIActionSheet *)actionSheetToPerformActionOnSelectedMap;
@property (nonatomic) UITableView * tableView;
@property (nonatomic) NSInteger selectedPosition;
@property (nonatomic) TMapOptions selectedInActionSheetOptions;

View file

@ -12,21 +12,28 @@
@implementation DownloaderParentVC
- (id)init
{
self = [super initWithStyle:UITableViewStyleGrouped];
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:self.tableView];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(outOfDateCountriesCountChanged:) name:MapsStatusChangedNotification object:nil];
}
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
_tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
return _tableView;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex != alertView.cancelButtonIndex)
@ -55,6 +62,11 @@
- (TStatus)selectedMapStatus { return TStatus::EUnknown; }
- (TMapOptions)selectedMapOptions { return TMapOptions::EMapOnly; }
#pragma mark - Virtual table view methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; }
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { return nil; }
#pragma mark - Public methods for successors
#define MB (1024 * 1024)