时间框显示在其他部位
let theRunLoop = NSRunLoop.currentRunLoop() as NSRunLoop
let fireDate = NSDate(timeIntervalSinceNow: 0)
let thetimer = NSTimer.init(fireDate: fireDate, interval: 1, target: self, selector: "timeMethod", userInfo: nil, repeats: true)
theRunLoop.addTimer(thetimer, forMode: NSDefaultRunLoopMode)
func timeMethod(){
let date = NSDate()
let timeFomatter = NSDateFormatter()
timeFomatter.dateFormat = "HH:mm"
let strNowTime = timeFomatter.stringFromDate(date) as String
self.timeLabel.text = strNowTime
}
self.timeLabel 是显示时间的label
修改时间栏位子
原文:http://www.cnblogs.com/zs12/p/5041326.html