1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

a0247 wrox professional iphone split 1 5448

7 5 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Manipulating and Displaying Data on the iPhone and iPad
Thể loại Book
Năm xuất bản 2010
Định dạng
Số trang 7
Dung lượng 1,08 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

xxiii PART I MANIPULATING AND DISPLAYING DATA ON THE IPHONE AND IPAD CHAPTER 1 Introducing Data-Driven Applications.. 19 CHAPTER 3 Displaying Your Data: The UITableView.. 89 PART II MA

Trang 3

PROFESSIONAL

IPHONE® AND IPAD™ DATABASE

APPLICATION PROGRAMMING

INTRODUCTION xxiii

PART I MANIPULATING AND DISPLAYING DATA ON THE IPHONE AND IPAD CHAPTER 1 Introducing Data-Driven Applications 3

CHAPTER 2 The iPhone and iPad Database: SQLite 19

CHAPTER 3 Displaying Your Data: The UITableView 57

CHAPTER 4 iPad Interface Elements 89

PART II MANAGING YOUR DATA WITH CORE DATA CHAPTER 5 Introducing Core Data 123

CHAPTER 6 Modeling Data in Xcode 145

CHAPTER 7 Building a Core Data Application 163

CHAPTER 8 Core Data–Related Cocoa Features 219

CHAPTER 9 Core Data Migration and Performance 235

PART III APPLICATION INTEGRATION USING WEB SERVICES CHAPTER 10 Working with XML on the iPhone 271

CHAPTER 11 Integrating with Web Services 301

APPENDIX A Tools for Troubleshooting Your Applications 343

INDEX 355







Trang 5

iPhone® and iPad™ Database Application Programming

Trang 6

Leave the numberOfSectionsInTableView method with the default implementation The table

will have only one section Change the tableView:numberOfRowsInSection: method to return

one row:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 1;

}

// Customize the number of rows in the table view

- (NSInteger)tableView:(UITableView *)tableView

numberOfRowsInSection:(NSInteger)section {

return 1;

}

EditTextController.m

Next, you should implement the tableView:cellForRowAtIndexPath: method to show the

// Customize the appearance of table view cells

- (UITableViewCell *)tableView:(UITableView *)tableView

cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @”Cell”;

UITableViewCell *cell =

[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

cell = [[[UITableViewCell alloc]

initWithStyle:UITableViewCellStyleDefault

reuseIdentifier:CellIdentifier] autorelease];

}

// Set up the cell

if (indexPath.row == 0)

{

UIView* cv = cell.contentView;

[cv addSubview:textField];

Trang 7

Implement tableView:didSelectRowAtIndexPath: to deselect the selected cell You don ’ t necessarily have to do this to complete the functionality of your application, but the Apple Human Interface Guidelines suggest that you deselect a tableview cell after its selection Therefore, I ’ m including the following code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // Deselect the currently selected row according to the HIG [tableView deselectRowAtIndexPath:indexPath animated:NO];

}

EditTextController.m

Last, but not least, you need to implement the dealloc method to clean up any memory that your class has allocated:

- (void)dealloc { [managedObject release];

[managedObjectContext release];

[keyString release];

[super dealloc];

}

EditTextController.m

Setting Priorities with the

EditPriorityController

The EditPriorityController screen, which you can see in Figure

7 - 8, allows the user to choose the priority for a task Again, you will implement the screen as a TableView This time, there will

be a row for each priority level In the Sub Controllers group, create a new UITableviewController without a NIB called EditPriorityController

In the header fi le, you will need to add instance variables and properties for a Task object and the context You will also need to add

like Listing 7 - 4

LISTING 7 - 4: EditPriorityController.h

#import < UIKit/UIKit.h >

#import “Task.h”

@interface EditPriorityController : UITableViewController {

continues

FIGURE 7 - 8: EditPriority Controller Screen

Building the Editing Controllers 185

Ngày đăng: 04/12/2022, 15:06

TỪ KHÓA LIÊN QUAN