ios - Block not being called -
ios - Block not being called -
i'm trying create work using swift https://github.com/skywinder/actionsheetpicker-3.0. problem when click done button or cancel button blocks not beingness called. how come this? i've set doneblock done variable , cancelblock cancel variable. nil returned in log?
@ibaction func openclosepicker(sender: uibutton!) { var stringpicker = actionsheetstringpicker(title: "nav bar picker", rows: ["one", "two", "a lot"], initialselection: 1, doneblock: {done in return}, cancelblock: {cancel in homecoming }, origin: sender.superview!.superview) stringpicker.showactionsheetpicker() allow done: actionstringdoneblock = {(picker: actionsheetstringpicker!, selectedindex: nsinteger!, selectedvalue : anyobject!) in println(selectedvalue) } allow cancel: actionstringcancelblock = {(picker: actionsheetstringpicker!) in println("block picker canceled") } }
i sense there wrong usage of variables done
, cancel
. looks referring them within anonymous block. have tried this?
@ibaction func openclosepicker(sender: uibutton!) { allow done: actionstringdoneblock = {(picker: actionsheetstringpicker!, selectedindex: nsinteger!, selectedvalue : anyobject!) in println(selectedvalue) } allow cancel: actionstringcancelblock = {(picker: actionsheetstringpicker!) in println("block picker canceled") } var stringpicker = actionsheetstringpicker(title: "nav bar picker", rows: ["one", "two", "a lot"], initialselection: 1, doneblock:done, cancelblock:cancel, origin: sender.superview!.superview) stringpicker.showactionsheetpicker() }
ios iphone swift objective-c-blocks
Comments
Post a Comment