Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Trọng tâm của hướng dẫn này chủ yếu sẽ được vào xem các mục Todo khi được chọn. Tôi cũng sẽ cho bạn thấy làm thế nào để cập nhật tình trạng Todo. Điều này sẽ yêu cầu chúng tôi sử dụng giao diện người xây dựng. | Bài 9 Creating a ToDo List Using SQLite Part 3 go on This is part 3 in our multipart series of creating a todo list for the iPhone. For this you must have completed the following tutorials. . iPhone Programming Tutorial - Creating a ToDo List Using SQLite Part 1 . iPhone Programming Tutorial - Creating a ToDo List Using SQLite Part 2 The focus of this tutorial will mainly be on viewing the todo items when selected. I will also show you how to update the todo status. This will require us to use interface builder. When you are completed you will be able to edit todos through an interface similar to this Collection By traibingo 94 Bringing Your Code Up To Speed For this tutorial we will need to get the last variable from the todo database. This is of course being the status variable. If you recall it s a boolean value 1 for complete 0 for in progress . We need to get it from the database and associate it with the todo object. First let s create a property to hold this value. Open todo.h and add the following code import -dJIKit UIKit.h import sqlite3.h interface Todo NSObject sqlite3 database NSString Hext NSInteger primaryKey NSInteger priority NSInteger status BOOL dirty property assign nonatomic readonly NSInteger primaryKey property nonatomic retain NSString Hext property nonatomic NSInteger priority property nonatomic NSInteger status - id initWithPrimaryKey NSInteger pk database sqlite3 db - void updateStatus NSInteger newStatus - void updatePriority NSInteger newPriority - void dehydrate So a few changes here.First there is the added NSInteger status. This will be the property we associate with the status complete or not of the todo. We also create a property from it. Next there is a BOOL property called dirty . We will use this object to signify when a todo has been altered. You will see how this comes into play when we implement the dehydrate method. Also I have added 3 method signatures. updateStatus will be the method called when we want to update our .