make use of Obj-C's modern syntax for literals and subscripting

This commit is contained in:
fridtjof
2019-01-08 00:24:11 +01:00
parent 125e801218
commit 0e8c73344d
27 changed files with 195 additions and 197 deletions

View File

@@ -243,7 +243,7 @@
// create programmatically each label
UILabel *label = [[UILabel alloc] init];
label.text = [sectionTitles objectAtIndex:index];
label.text = sectionTitles[index];
label.font = [UIFont systemFontOfSize:17];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = _sectionHeaderTintColor;
@@ -263,7 +263,7 @@
leftConstraint = [NSLayoutConstraint constraintWithItem:label
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[labels objectAtIndex:(index-1)]
toItem:labels[index - 1]
attribute:NSLayoutAttributeTrailing
multiplier:1.0
constant:0];
@@ -339,7 +339,7 @@
leftMarkerViewConstraint = [NSLayoutConstraint constraintWithItem:selectedMarkerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[sectionLabels objectAtIndex:_selectedIndex]
toItem:sectionLabels[_selectedIndex]
attribute:NSLayoutAttributeLeading
multiplier:1.0
constant:0];
@@ -386,7 +386,7 @@
if (index != NSNotFound)
{
UILabel* label = [sectionLabels objectAtIndex:index];
UILabel* label = sectionLabels[index];
label.font = [UIFont systemFontOfSize:17];
}
@@ -398,7 +398,7 @@
[NSLayoutConstraint deactivateConstraints:@[displayedVCTopConstraint, displayedVCLeftConstraint, displayedVCWidthConstraint, displayedVCHeightConstraint]];
}
UILabel* label = [sectionLabels objectAtIndex:_selectedIndex];
UILabel* label = sectionLabels[_selectedIndex];
label.font = [UIFont boldSystemFontOfSize:17];
// update the marker view position
@@ -407,7 +407,7 @@
leftMarkerViewConstraint = [NSLayoutConstraint constraintWithItem:selectedMarkerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[sectionLabels objectAtIndex:_selectedIndex]
toItem:sectionLabels[_selectedIndex]
attribute:NSLayoutAttributeLeading
multiplier:1.0
constant:0];
@@ -415,7 +415,7 @@
[NSLayoutConstraint activateConstraints:@[leftMarkerViewConstraint]];
// Set the new selected view controller
_selectedViewController = [viewControllers objectAtIndex:_selectedIndex];
_selectedViewController = viewControllers[_selectedIndex];
// Make iOS invoke selectedViewController viewWillAppear when the segmented view is already visible
if (isViewAppeared)