Today we will learn how to make a simple custom tableview in ios using Xcode8 and swift 3
Full Code and Explanation Here
Full Code and Explanation Here
4. Now we will first hide the toolBar, dateLabel and DatePicker and then on Button Click we will unhide it. We will just take the date vale from datepicker and will write into Label.
@IBOutlet weak var dateToolBar: UIToolbar!
@IBOutlet weak var datePicker:UIDatePicker!
@IBOutlet weak var dateLabel:UILabel!
@IBAction func toolBarCancelItem(sender: AnyObject) {
}
@IBAction func doneButtonItem(sender: AnyObject) {
}
@IBAction func showDatePickerButtonAction(sender: AnyObject) {
}
override func viewDidLoad() {super.viewDidLoad()self.dateLabel.hidden = trueself.datePicker.hidden = trueself.dateToolBar.hidden = true// 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.}@IBAction func toolBarCancelItem(sender: AnyObject) {self.dateLabel.hidden = trueself.datePicker.hidden = trueself.dateToolBar.hidden = true}@IBAction func doneButtonItem(sender: AnyObject) {let dateFormatter = NSDateFormatter()dateFormatter.dateFormat = "dd-MM-yyyy HH:mm" // Here You can customize the formatter according to Your use.let strDate = dateFormatter.stringFromDate(datePicker.date)self.dateLabel.text = strDate}@IBAction func showDatePickerButtonAction(sender: AnyObject) {self.dateLabel.hidden = falseself.datePicker.hidden = falseself.dateToolBar.hidden = false}