Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BSModalPickerView/BSModalPickerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ typedef void (^BSModalPickerViewCallback)(BOOL madeChoice);

/* Override and return any additional buttons that you want on the toolbar. By default, this is just a flexible space item. */
- (NSArray *)additionalToolbarItems;

@property (nonatomic) UIBarStyle toolbarStyle;

@end
5 changes: 4 additions & 1 deletion BSModalPickerView/BSModalPickerBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ @interface BSModalPickerBase ()

@implementation BSModalPickerBase

@synthesize toolbarStyle;

#pragma mark - Designated Initializer

- (id)init {
self = [super init];
if (self) {
self.toolbarStyle = UIBarStyleBlackTranslucent;
self.autoresizesSubviews = YES;
self.presentBackdropView = YES;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
Expand Down Expand Up @@ -65,7 +68,7 @@ - (NSArray *)additionalToolbarItems {
- (UIToolbar *)toolbar {
if (!_toolbar) {
_toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, BSMODALPICKER_TOOLBAR_HEIGHT)];
_toolbar.barStyle = UIBarStyleBlackTranslucent;
_toolbar.barStyle = toolbarStyle;
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(onCancel:)];
Expand Down
5 changes: 3 additions & 2 deletions BSModalPickerView/BSModalPickerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ - (void)setValues:(NSArray *)values {
- (void)setSelectedIndex:(NSUInteger)selectedIndex {
if (_selectedIndex != selectedIndex) {
_selectedIndex = selectedIndex;
if (self.picker) {
UIPickerView *pickerView = (UIPickerView *)self.picker;
self.indexSelectedBeforeDismissal = selectedIndex;
if (_picker) {
UIPickerView *pickerView = (UIPickerView *)_picker;
[pickerView selectRow:selectedIndex inComponent:0 animated:YES];
}
}
Expand Down