ISelect - 下拉框控件

ISelect 样式和 Web 的下拉框控件类似, 用于满足基本的下拉框表单控件需求.

XML

<select>
    <option value="1">option 1</option>
    <option value="2">option 2</option>
    <option value="3">option 3</option>
    <option value="4">option 4</option>
</select>/

API

@interface ISelect : IView

@property (readonly, nonatomic) ILabel *label;
@property (readonly, nonatomic) ILabel *arrow;

@property (nonatomic) NSInteger selectedIndex;
@property (nonatomic) NSString *selectedKey;
@property (readonly, nonatomic) NSString *selectedText;

- (void)addOptionKey:(NSString *)key text:(NSString *)text;

- (void)onSelectKey:(void (^)(NSString *key))callback;

@end

Demo

ISelect *sel = (ISelect *)[view getViewById:@"select1"];
[sel onSelectKey:^(NSString *key) {
    log_debug(@"select %@", key);
}];