swift中使用oc的Block

oc用法

[DatePickerViewshowDatePickerWithTitle:@"出生年月"dateType:UIDatePickerModeDatedefaultSelValue:weakSelf.birthdayTF.textminDateStr:@""maxDateStr:[NSDatecurrentDateString]isAutoSelect:YESresultBlock:^(NSString*selectValue) {

weakSelf.birthdayTF.text= selectValue;

}];


swift用法

DatePickerView.showDatePicker(withTitle:"開始時間", dateType: .dateAndTime, defaultSelValue:self.startTime, minDateStr: formatter.string(from:NSDate()asDate), maxDateStr:"", isAutoSelect:true, resultBlock: { (selectValue:String?)in

ifselectValue !=nil&&!(selectValue?.isEmpty)! {

self.startTime= selectValue!

self.startField.text=self.startTime

}

} )

你可能感兴趣的:(swift中使用oc的Block)