Last active
September 5, 2017 20:15
-
-
Save Ryu955/e2ab6ace80c899d65400126421aa16d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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