From 5227868b79dafca8062f3d1c64ab34300e08e8a7 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 2 Dec 2023 14:49:03 -0500 Subject: [PATCH] Slot selectValue - return BOOL to indicate if selected. --- Ample/Slot.h | 2 +- Ample/Slot.m | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Ample/Slot.h b/Ample/Slot.h index 7e94492..f26789f 100644 --- a/Ample/Slot.h +++ b/Ample/Slot.h @@ -42,7 +42,7 @@ typedef enum SlotType { -(void)reset; -(void)prepareView: (SlotTableCellView *)view; --(void)selectValue: (NSString *)value; +-(BOOL)selectValue: (NSString *)value; -(Media)selectedMedia; diff --git a/Ample/Slot.m b/Ample/Slot.m index f503001..c590f7c 100644 --- a/Ample/Slot.m +++ b/Ample/Slot.m @@ -96,18 +96,19 @@ static NSDictionary *TypeMap = nil; } } --(void)selectValue: (NSString *)value { +-(BOOL)selectValue: (NSString *)value { if (value) { NSInteger index = 0; for (SlotOption *item in _options) { if ([[item value] isEqualToString: value]) { [self setSelectedIndex: index]; - return; + return YES; } ++index; } } + return NO; //[self setSelectedIndex: _defaultIndex >= 0 ? _defaultIndex : 0]; }