Skip to content

Instantly share code, notes, and snippets.

@Ryu955
Last active September 5, 2017 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ryu955/e2ab6ace80c899d65400126421aa16d2 to your computer and use it in GitHub Desktop.
Save Ryu955/e2ab6ace80c899d65400126421aa16d2 to your computer and use it in GitHub Desktop.
import UIKit
// import忘れないように
import CoreActionSheetPicker
class ViewController: UIViewController {
@IBOutlet weak var result: UILabel!
@IBAction func inputButton(_ sender: Any) {
let timePicker = ActionSheetDatePicker(title: "Date:", datePickerMode: UIDatePickerMode.time, selectedDate: Date(), doneBlock: {
picker, value, index in
let formatter = DateFormatter()
formatter.dateFormat = "a hh時mm分"
self.result.text = formatter.string(for: value)
print("value = \(value)")
print("index = \(index)")
print("picker = \(picker)")
return
}, cancel: { ActionStringCancelBlock in
print("cancel")
return }, origin: self.view)
timePicker?.minuteInterval = 5
timePicker?.locale = Calendar.current.locale
timePicker?.show()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment