Sono nuovo a Swift e sto provando un programmatore. Ho selezionato l'ora di inizio e devo aggiungere 5 minuti (o multipli di esso) all'ora di inizio e visualizzarla in un UILabel?Come aggiungere minuti all'ora corrente in swift
@IBAction func timePickerClicked(sender: UIDatePicker) {
var dateFormatter = NSDateFormatter()
dateFormatter.timeStyle = NSDateFormatterStyle.ShortStyle
var dateStr = dateFormatter.stringFromDate(startTime.date)
let sttime = dateStr
startTimeDisplay.text = dateStr
}
// How to advance time by 5 minutes for each section based on the start time selected and display time
// section 1 = start time + 5
// section 2 = start time + 10*
sicuro che presto, appena finito il porting mia app per Swift3 ma havent finito testarlo –
@DanBeaulieu fatto –
Sotto quali circostanze fa '.date (byAdding: value: to)' return 'nil'? Siamo sicuri di forzare lo scartare qui? – Deco