@IBAction func okTapped(sender: AnyObject) {
yearOfBirth.resignFirstResponder()
if let year = Int(yearOfBirth.text!){
let imageNumber = (year-offset)%12
image.image = UIImage(named: String(imageNumber))
}
}
yearOfBirth.resignFirstResponder()
if let year = Int(yearOfBirth.text!){
let imageNumber = (year-offset)%12
image.image = UIImage(named: String(imageNumber))
}
}
2016-04-14
let cell = self.tableView.dequeueReusableCellWithIdentifier("todoCell", forIndexPath: indexPath)
2016-04-08
swift2.0 int转换写法有些不一样。
if let year = Int(yearOfBirth.text!){
...
}
if let year = Int(yearOfBirth.text!){
...
}
2016-04-05
创建IBAction链接的时候就可以直接选择sender为UISlider,下面就可以直接把sender赋值给slider,不需要as UISlider!
@IBAction func heightChanged(sender: UISlider) {
let slider = sender
height.text = "\(Int(slider.value))cm"
}
老师怎么不用这种方法呢?有什么原因吗?
@IBAction func heightChanged(sender: UISlider) {
let slider = sender
height.text = "\(Int(slider.value))cm"
}
老师怎么不用这种方法呢?有什么原因吗?
2016-04-03
self.tableView.setEditing(editing,animated:animated)
这行代码会报错啊,无法运行
这行代码会报错啊,无法运行
2016-03-29