Skip to content

Commit 2f4fb53

Browse files
committed
Added IASKQuickMultiValueSelection
when set to true for a PSMultiValueSpecifier, the child view controller is popped on selection
1 parent 8e541ae commit 2f4fb53

File tree

6 files changed

+13
-0
lines changed

6 files changed

+13
-0
lines changed

InAppSettingsKitSampleApp/Settings.bundle/Root~iphone.inApp.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
</array>
100100
<key>IASKTextAlignment</key>
101101
<string>IASKUITextAlignmentLeft</string>
102+
<key>IASKQuickMultiValueSelection</key>
103+
<true/>
102104
</dict>
103105
<dict>
104106
<key>Title</key>

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ The [sample application](#sample-application) returns a list of all country code
374374
375375
MultiValue lists can be sorted alphabetically by adding a `true` Boolean `DisplaySortedByTitle` key in the Plist.
376376
MultiValue list entries can be given an image. Specify images via the `IconNames` attribute (next to Values/Titles/ShortTitles etc.).
377+
MultiValue lists support an `IASKQuickMultiValueSelection` boolean key. If set to true, the child view controller is popped on selection, so tapping the back button is not needed.
377378
378379
379380
## Settings Storage

Sources/InAppSettingsKit/Controllers/IASKSpecifierValuesViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
144144

145145
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
146146
[self.selection selectRowAtIndexPath:indexPath];
147+
148+
if (self.currentSpecifier.quickSelection) {
149+
[self.navigationController popViewControllerAnimated:YES];
150+
}
147151
}
148152

149153
@end

Sources/InAppSettingsKit/Models/IASKSpecifier.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,10 @@ - (NSTextAlignment)textAlignment {
511511
return result;
512512
}
513513

514+
- (BOOL)quickSelection {
515+
return [[_specifierDict objectForKey:kIASKQuickMultiValueSelection] boolValue];
516+
}
517+
514518
- (NSArray *)userInterfaceIdioms {
515519
NSMutableDictionary *idiomMap = [NSMutableDictionary dictionaryWithDictionary:
516520
@{

Sources/InAppSettingsKit/include/IASKSettingsReader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ NS_ASSUME_NONNULL_BEGIN
122122
#define kIASKToggleStyle @"IASKToggleStyle"
123123
#define kIASKToggleStyleCheckmark @"Checkmark"
124124
#define kIASKToggleStyleSwitch @"Switch"
125+
#define kIASKQuickMultiValueSelection @"IASKQuickMultiValueSelection"
125126

126127
#define kIASKPSGroupSpecifier @"PSGroupSpecifier"
127128
#define kIASKListGroupSpecifier @"IASKListGroupSpecifier"

Sources/InAppSettingsKit/include/IASKSpecifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
6363
@property (nonatomic, readonly) BOOL adjustsFontSizeToFitWidth;
6464
@property (nonatomic, readonly) NSTextAlignment textAlignment;
6565
@property (nonatomic, readonly) NSArray<IASKSpecifier*>* multiValueChildSpecifiers;
66+
@property (nonatomic, readonly) BOOL quickSelection;
6667

6768
- (nullable NSString*)localizedObjectForKey:(NSString*)key;
6869
- (nullable NSString*)titleForCurrentValue:(nullable id)currentValue;

0 commit comments

Comments
 (0)