[cleanup] [ios] Fixed old, verbose Objective-C syntax.

This commit is contained in:
Ilya Grechuhin 2017-01-10 16:51:43 +03:00
parent 52507ed344
commit da2f4a0148
4 changed files with 9 additions and 11 deletions

View file

@ -52,7 +52,7 @@
label.textColor = [UIColor blackPrimaryText];
[m_hint addSubview:label];
}
UILabel * label = [m_hint.subviews objectAtIndex:0];
UILabel * label = m_hint.subviews.firstObject;
label.bounds = CGRectInset(rect, offset, offset);
[label sizeToIntegralFit];
m_hint.bounds = CGRectMake(0, 0, rect.size.width, label.bounds.size.height + 2 * offset);
@ -238,7 +238,7 @@
[[NSNotificationCenter defaultCenter] postNotificationName:BOOKMARK_CATEGORY_DELETED_NOTIFICATION object:@(indexPath.row)];
Framework & f = GetFramework();
f.DeleteBmCategory(indexPath.row);
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
// Disable edit mode if no categories are left
if (!f.GetBmCategoriesCount())
{

View file

@ -139,7 +139,7 @@ extern NSString * const kBookmarksChangedNotification = @"BookmarksChangedNotifi
string dist;
if (measurement_utils::FormatDistance(tr->GetLengthMeters(), dist))
//Change Length before release!!!
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@", L(@"length"), [NSString stringWithUTF8String:dist.c_str()]];
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ %@", L(@"length"), @(dist.c_str())];
else
cell.detailTextLabel.text = nil;
const dp::Color c = tr->GetColor(0);
@ -246,7 +246,7 @@ extern NSString * const kBookmarksChangedNotification = @"BookmarksChangedNotifi
if (cat)
{
[Statistics logEvent:kStatEventName(kStatBookmarks, kStatExport)];
NSMutableString * catName = [NSMutableString stringWithUTF8String:cat->GetName().c_str()];
NSMutableString * catName = @(cat->GetName().c_str());
if (![catName length])
[catName setString:@"MapsMe"];
@ -308,7 +308,7 @@ extern NSString * const kBookmarksChangedNotification = @"BookmarksChangedNotifi
[self calculateSections];
//We can delete the row with animation, if number of sections stay the same.
if (previousNumberOfSections == m_numberOfSections)
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView deleteRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationFade];
else
[self.tableView reloadData];
if (cat->GetUserMarkCount() + cat->GetTracksCount() == 0)

View file

@ -36,8 +36,9 @@ namespace
}
alert.message.text = message;
NSMutableDictionary <NSString *, NSString *> * info = [@{kStatValue : alert.statMessage} mutableCopy];
if (NSString * un = osm_auth_ios::OSMUserName())
[info setObject:un forKey:kStatOSMUserName];
NSString * un = osm_auth_ios::OSMUserName();
if (un)
info[kStatOSMUserName] = un;
[Statistics logEvent:kStatEditorSecondTimeShareShow withParameters:info];
return alert;

View file

@ -202,10 +202,7 @@ NSDictionary * const kDeviceNamesWithMetalDriver = @{
{
if (!_buildDate)
{
NSString * dateStr =
[NSString stringWithFormat:@"%@ %@", [NSString stringWithUTF8String:__DATE__],
[NSString stringWithUTF8String:__TIME__]];
NSString * dateStr = [NSString stringWithFormat:@"%@ %@", @(__DATE__), @(__TIME__)];
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"LLL d yyyy HH:mm:ss"];
[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];