点击编辑没有添加成功 进行了调试 由于只是初学不懂是什么意思
uuid 和todo是否没取到值
如果没有 那需要怎么修改
var image = ""
if "" == image {
image = "selected-child"
}
if todo == nil {
let uuid = NSUUID().UUIDString
let todo = TodoModel(id: uuid, image: image, title: todoItem.text!, date: todoDate.date)
todos.append(todo)
}
else {
todo?.image = image
todo?.title = todoItem.text!
todo?.date = todoDate.date
}
1、ViewController.swift中
修改下面所有的 todos 为 ViewController.todos
2、DetailViewController.swift 中
(你需要在storyboard中control拖拽确定到 这个VC的exit上面,最上面一排最右边一个)
修改todos 为 ViewController.todos
3、添加功能正常了。
4、关于修改功能,选中liestview项编辑,需要在DetaiViewController中使用segue查看传入的todos数组的索引号,然后修改todos,这部分我没有做。
Github上已经提交。