File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
7575
7676 if (![self .loader.architecture isEqualToString: arch]) {
7777 BlockSafetyCallWithArgs (self.pickCompletion , arch);
78+
7879 [self .loader loadArchitecture: arch];
7980 }
8081
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ @implementation ACollectionViewDataHandle
3636
3737- (nonnull __kindof UICollectionViewCell *) collectionView : (nonnull UICollectionView *)collectionView cellForItemAtIndexPath : (nonnull NSIndexPath *)indexPath {
3838 ACollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier: ACollectionViewCell.identifier forIndexPath: indexPath];
39- cell.instruction = self.instructions [ indexPath.row] ;
39+ cell.instruction = safetyObjectAtIndex ( self.instructions , indexPath.row ) ;
4040
4141 return cell;
4242}
@@ -65,7 +65,7 @@ - (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIn
6565
6666- (CGSize) collectionView : (UICollectionView *)collectionView layout : (UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath : (NSIndexPath *)indexPath {
6767 ACollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier: ACollectionViewCell.identifier forIndexPath: indexPath];
68- cell.instruction = self.instructions [ indexPath.row] ;
68+ cell.instruction = safetyObjectAtIndex ( self.instructions , indexPath.row ) ;
6969
7070 CGFloat maxSize = [cell maxSizeForInstruction: self .instructions[indexPath.row] withWidth: collectionView.bounds.size.width - 20 .0f ];
7171
Original file line number Diff line number Diff line change 4848#define BlockSafetyCallWithArgs (block , ...) \
4949 if (block) block(__VA_ARGS__)
5050
51+ // Array
52+ #define safetyObjectAtIndex (array , index ) \
53+ (array.count > index ? array[index] : nil)
54+
55+ #define safetyPointerObjectAtIndex (array , index ) \
56+ (array.count > index ? [array pointerAtIndex:index] : nil)
57+
58+
5159#endif /* Defines_h */
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ - (void) _changeArch:(UIBarButtonItem *)item {
104104 strongify (self);
105105
106106 [self _showNoDataStyle: YES ];
107+ [self .collectionView setContentOffset: CGPointZero animated: NO ];
107108 };
108109
109110 [self .navigationController pushViewController: viewController animated: YES ];
You can’t perform that action at this time.
0 commit comments