[cleanup] [ios] Bookmarks code cleanup.

This commit is contained in:
Ilya Grechuhin 2017-01-25 15:26:12 +03:00
parent 62003ecec3
commit b8dc24178c
3 changed files with 13 additions and 14 deletions

View file

@ -1,14 +1,10 @@
#import "AddSetVC.h"
#import "UIViewController+Navigation.h"
#import "AddSetTableViewCell.h"
#import "SwiftBridge.h"
#import "UIViewController+Navigation.h"
#include "Framework.h"
#define TEXT_FIELD_TAG 666
static NSString * const kAddSetCellTableViewCell = @"AddSetTableViewCell";
@interface AddSetVC () <AddSetTableViewCellProtocol>
@property (nonatomic) AddSetTableViewCell * cell;
@ -29,8 +25,7 @@ static NSString * const kAddSetCellTableViewCell = @"AddSetTableViewCell";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSaveClicked)];
[(UIViewController *)self showBackButton];
self.title = L(@"add_new_set");
[self.tableView registerNib:[UINib nibWithNibName:kAddSetCellTableViewCell bundle:nil]
forCellReuseIdentifier:kAddSetCellTableViewCell];
[self.tableView registerWithCellClass:[AddSetTableViewCell class]];
}
- (void)onSaveClicked
@ -53,7 +48,8 @@ static NSString * const kAddSetCellTableViewCell = @"AddSetTableViewCell";
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
self.cell = (AddSetTableViewCell *)[tableView dequeueReusableCellWithIdentifier:kAddSetCellTableViewCell];
self.cell = static_cast<AddSetTableViewCell *>(
[tableView dequeueReusableCellWithCellClass:[AddSetTableViewCell class] indexPath:indexPath]);
self.cell.delegate = self;
return self.cell;
}

View file

@ -11,6 +11,7 @@
#import "MapViewController.h"
#import "MapsAppDelegate.h"
#import "Statistics.h"
#import "SwiftBridge.h"
#include "Framework.h"
@ -53,8 +54,7 @@ extern NSString * const kBookmarksChangedNotification = @"BookmarksChangedNotifi
- (void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:[MWMBookmarkNameCell className] bundle:nil]
forCellReuseIdentifier:[MWMBookmarkNameCell className]];
[self.tableView registerWithCellClass:[MWMBookmarkNameCell class]];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
@ -110,7 +110,8 @@ extern NSString * const kBookmarksChangedNotification = @"BookmarksChangedNotifi
{
if (indexPath.row == 0)
{
cell = [tableView dequeueReusableCellWithIdentifier:[MWMBookmarkNameCell className]];
cell = [tableView dequeueReusableCellWithCellClass:[MWMBookmarkNameCell class]
indexPath:indexPath];
[static_cast<MWMBookmarkNameCell *>(cell) configWithName:@(cat->GetName().c_str()) delegate:self];
}
else

View file

@ -1,5 +1,6 @@
#import "AddSetVC.h"
#import "SelectSetVC.h"
#import "AddSetVC.h"
#import "SwiftBridge.h"
#import "UIViewController+Navigation.h"
#include "Framework.h"
@ -55,7 +56,8 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:[UITableViewCell className]];
Class cls = [UITableViewCell class];
auto cell = [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath];
if (indexPath.section == 0)
{
cell.textLabel.text = L(@"add_new_set");