gklka / GKActionSheetPicker

An easy-to-use controller for presenting UIPickerView in overlay view
MIT License
25 stars 9 forks source link

Does it work? #6

Closed vadimvitvickiy closed 7 years ago

vadimvitvickiy commented 7 years ago

After presenting picker cant dismiss it, and if scroll values they just disappear

gklka commented 7 years ago

Could you please specify your problem? Please show me the code which you wrote.

vadimvitvickiy commented 7 years ago
func pickDate() {
        let dates = schedules.map {
            GKActionSheetPickerItem(title: $0.start?.string(format: dateShowFormat), value: $0)!
        }

        let actionSheetPicker = GKActionSheetPicker.stringPicker(withItems: dates, selectCallback: { [unowned self] schedule in
            self.selectedDate = (schedule as! Schedule).start
        }, cancelCallback: nil)

        actionSheetPicker?.dismissType = .cancel

        actionSheetPicker?.present(on: mainVC?.view)
    }
gklka commented 7 years ago

I don't know much about Swift (honestly: never tried the lib in Swift) but this should work. I'll take a look at it.

RajChanchal commented 7 years ago

It's even not working in Objective-C either:

GKActionSheetPicker *picker  = [GKActionSheetPicker stringPickerWithItems:self.words selectCallback:^(id selected) {
       print(@"selected word: %@",selected);
    } cancelCallback:^{

    }];

Cannot cancel the sheet.

gklka commented 7 years ago

Please try use a strong reference to it, for example a @property

RajChanchal commented 7 years ago

Yes, this was the reason. :)