swift3 报错 unrecognized selector sent to instance
2017-02-10
//计算年龄的方法
let now = Date()
let calendar = Calendar(identifier: .gregorian)
let nowYear = calendar.component(.year, from: now)
let birthdayYear = calendar.component(.year, from: birthday.date)
let age = nowYear - birthdayYear
let now = Date()
let calendar = Calendar(identifier: .gregorian)
let nowYear = calendar.component(.year, from: now)
let birthdayYear = calendar.component(.year, from: birthday.date)
let age = nowYear - birthdayYear
2017-01-14
let age = now! - year!
let hasPropertyText = hasProperty.on ? "有房" : "无房"
result.text = "\(name.text), \(age)岁,\(genderText),身高\(height.text!),\(hasPropertyText)"
let hasPropertyText = hasProperty.on ? "有房" : "无房"
result.text = "\(name.text), \(age)岁,\(genderText),身高\(height.text!),\(hasPropertyText)"
2016-12-22
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy"
let year = dateFormatter.stringFromDate(birthday.date).toInt()
let now = dateFormatter.stringFromDate(NSDate()).toInt()
dateFormatter.dateFormat = "yyyy"
let year = dateFormatter.stringFromDate(birthday.date).toInt()
let now = dateFormatter.stringFromDate(NSDate()).toInt()
2016-12-22