Phát triển ứng dụng cho iPhone và iPad - part 41 pot

10 90 0
Phát triển ứng dụng cho iPhone và iPad - part 41 pot

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

Thông tin tài liệu

369 details, 90 redrawing views, 69 regular expressions, building, 149 relational databases, 21 relationships entities, 150–153 To-Many, 151 releasing memory, 170–171 rendering strings, 70 reponseData property, 318 requests to server, creating, 277–278 responseData property, 336–337 responseData variable, 275 REST-based API, 313–315 REST (REpresentational State Transfer), 307–308 Result class, defi ning, 320–322 result set, 43 results fi ltering, NSPredicate, 204–205 sorting, NSSortDescriptor, 203–204 retain count, 346 retainCount message, 347 retrieving data, 8 synchronous, 273 reuseIdentifier, 63 reusing cells, 85–86 RMI (Remote Method Invocation), 304 root node, 295 Root View Controller, Detail View Controller and, 94 RootViewController, 35, 50–52 DetailViewController and, 91 master-detail interface, 99 task manager project, 132–137 Tasks application (advanced), 167–171, 178–179 template code, 94 rows (databases) content, displaying, 175 inserting, 27 number of, 76 reading, 28–31 RSS (Really Simple Syndication), 275 TextView, 288 RSSSample application, 275–276 runtime, default data, 212–213 S SampleTableProjectView controller.m, 15–16 saveButtonPressed method, 197 SAX (Serial Access Parser), 284 scalar data types, 222 schema migration, 235–236 schemas, standardized, 283 scripting, 25 scrolling debugging, 85 TableView, 62 search implementing, 78–85 location based, 308–331 search bar searchBar property, 315 UISearchBar control, 315 searchBar property, 309, 315 delegate methods, 316 section arrays, 72 section headers, 72 sectionNameKeyPath parameter, 207 sections, 72–78 SELECT statement (SQL), 28–31, 42 selectionStyle property, 61 self class, 112 serialization description, 116 surveyDataArray, 115–116 server requesting data, 277–282 requests, creating, 277–278 records – server bindex.indd 369bindex.indd 369 9/17/10 7:26:10 PM9/17/10 7:26:10 PM 370 setLabelsForProduct method, 53 setProduct: method, 68 setText method, 105 setValue:forKey: method, 222 sharing fi les enabling, 115 Survey data, 118–119 Show Differences button, 244 showInfo method, 107 SOAP messaging, 306–307 SOAP (Simple Object Access Protocol), 306 sort descriptors, 219, 233–234 arrays, 233 compare: method, 233 initializing, 233 text attribute, 170 sortedArrayUsingDescriptors method, 234 sorting results, NSSortDescriptor, 203–204 Split View-based Applications, templates, 91 Split View sample application, starting, 93–95 SQL For Dummies (Taylor), 25, 56 SQL (Structured Query Language) joins, 30–31 keywords, 27 statements INSERT, 26–28 SELECT, 28–31 terminators, 27 SQLite confi guration fi les, 20 Core Data and, 124, 127 Core Data API comparison, 20–21 CREATE TABLE statement, 25 databases, visualizing, 31–33 foreign key constraints, 26 library, 20 pre-loading applications, 20 relational database, 21 setup, 20 SQL and, 20 website, 56 sqlite3 library, 38 SQLite Manager, 31–33 sqlite3_close method, 40 sqlite3_finalize method, 45 sqlite3_open method, 40 sqlite3_prepare_v2 method, 43 standardized schemas, 283 statements @dynamic, 172 executing, 43 import, 38 #import, 9 SELECT, 42 switch, 262 synthesize, 169 Static Analyzer, 351–353 stopUpdatingLocation method, 311–312 stored fetched requests, 202 String Programming Guide for Cocoa, 234 strings databases, retrieving, 44 dot-separated, 220 keys, 220 length constraints, 149 mutable, parsing and, 286 predicates, creating, 231–232 regular expressions, 149 rendering, 70 stringValue method, 98 stringWithFormat method, 317 struct data types, 222 stub implementation, action methods, 169 styles, TableViewCell, 58–61 Sub Controllers group, UITableViewController, 181 setLabelsForProduct method – Sub Controllers group bindex.indd 370bindex.indd 370 9/17/10 7:26:11 PM9/17/10 7:26:11 PM 371 subclasses NSManagedObject, 171–172 custom, 155–159 UITableViewCell, 65–71 substitution variables, 202 subtitle property, 322 subviews, 57 contentView, 61–65 opaque, 86–87 @sum function, 222 superclasses, init method, 10 Survey App Delegate, 94 Survey application detail interface, 95–97 fi le sharing, 115 sharing data, 118–119 starting, 94–95 surveys, adding, 101–103 SurveyAppDelegate, applicationWillTerminate method, 115 surveyDataArray, 99 deserializing, 117–118 loading, 117–118 serializing, 115–116 switch statement, 262 Sync Services, 148–149 synchronization, 148–149 synchronous data retrieval, 273 @synthesize, accessor methods, 220 @synthesize keyword, 158 synthesize statement, 169 synthesizing properties, 50, 174 T Tab Bar Application template, 5 table view, populating, 36–37 tables, grouped, NSFetchedResultsController, 205–211 TableView adding programmatically, 7–8 delegate methods, 135 location, 8 methods implementing, 36 master-detail interface, 100–101 performance optimization, 85–88 references, 36 row editing, 136 row selection, 35 scrolling, 62 debugging, 85 size, 8 styles, 57 TableViewCells, 62 TableView methods, 51, 179 TableViewCell, 51 tableview property, 169 TableViewCell CatalogTableViewCell subclass, 66 controls, 66 creating, Interface Builder and, 57 styles, 58–61 subviews, 57 tableView:cellForRowAtIndexPath: method, 175 tableView:numberOfRowsInSection: method, 175 Task entity, 137 Task entity, 170 Task object, editing text, 181 TaskAppsDelegate, 128–131 TaskEntryViewController, implementation, 139 TaskEntryViewController.h, 139 Tasks application, 159–161 creating, 127–128 Task entity, 137 template code data model, 131–132 subclasses – Tasks application bindex.indd 371bindex.indd 371 9/17/10 7:26:11 PM9/17/10 7:26:11 PM 372 Tasks application (continued) Event entity, 131 modifying, 137–143 RootViewController, 132–137 TaskAppsDelegate, 128–131 Tasks application (advanced) class model, 164–165 coding, 167 data model, 164 editing controllers, 180 EditDateController, 195–199 EditLocationController, 189–194 EditPriorityController, 185–188 EditTextController, 181–185 new tasks, 167 RootViewController, 178–179 RootViewController screen, building, 167–171 tasks adding, 172–179 viewing, 172–179 user interface, 165–167 Tasks.xcdatamodel, 131 taskTableView property, 169 Taylor, Allen, SQL For Dummies, 25, 56 template code, task manager project modifying, 137–143 Task entity, 137 TaskAppsDelegate, 128–131 templates Fetch Request templates, 155 Navigation-based Application, 4 RootViewController, 94 Split View-based Application projects, 91 Tab Bar Application, 5 View-based Applications, 5 TermExtract application, 332–334 user interface, building, 334–335 XML response, 338–339 terminal window, command-line, 25 text databases, retrieving, 44 editing, EditTextController, 181–185 indentation, 61 labels, 58 setting, 53–54 popovers, 105 text attribute, 170 text fi les, reading, 18 textLabel property, 58 textView property, 287 threading Core Data and, 247–248 example, 249–257 designing for, 246–247 Managed Object Context, 248 NSOperation class, 248–249 Persistent Store Coordinator, 248 three-tier architecture, 303–304 title element, 290 Title property, 52 To-Many Relationship, 151 toolbarFilterAll method, 205 toolbarFilterWiPri method, 204–205 toolbars adding, 168 buttons, methods invoked, 168–169 toolbarSortOrderChanged method, 203–204 tools Instruments, 343–351 Static Analyzer, 351–353 Touch Up Inside event, 276 trace document (Instruments), 345–346 Track pane (Instruments), 267 Transformable data type, 150 Transient checkbox, 150 transient properties, isOverdue, 179 transparent views, 68 two-tier architecture, 302–303 Tasks application – two-tier architecture bindex.indd 372bindex.indd 372 9/17/10 7:26:12 PM9/17/10 7:26:12 PM 373 U UIApplication object, 103 UIButton, 107, 276 UIFileSharingEnabled, 115 UIGestureRecognizer class, 110–111 UILabel, 105 variables, 225 UILabels, 53 UILocalizedIndexedCollation class, 72 UINavigationController, 34–35 UIPopoverArrowDirection, 109 UIPopoverController, 103 displaying, 107–110 UIViewController as content, 103 UISearchBar control, 78, 310, 315 UISearchDisplayController, 78 UISplitViewController, 90–92 UIPopoverController, 103 UISplitViewControllerDelegate protocol, 92–93 UISwipeGestureRecognizer, 111–112 UITableView, 6, 35 Contacts application and, 6 creating instance, 7 DataSource property, 15 delegate property, 15 UITableViewCell, subclasses, 65–71 UITableViewCellAccessory Checkmark, 60 UITableViewCellAccessoryDetail DisclosureButton, 60 UITableViewCellAccessory DisclosureIndicator, 60 UITableViewCellStyleDefault, 58 UITableViewCellStyleSubtitle, 58 UITableViewCellStyleValue1, 58 UITableViewCellStyleValue2, 58 UITableViewController, 35–36, 181 UITableViewDataSource protocol, implementing, 13 UITextView outlet, 286 UIViewController, 52, 139 task manager advanced project, 165 UIPopoverController, 103 Umpire application Counter data object, 226–227 inheritance, 228 interface, building, 225–226 KVO, 227–229 outlets ballLabel, 226 outLabel, 226 strikeLabel, 226 UmpireCounter property, 227 UmpireViewController, 224 @unionOfArrays function, 222 @unionOfObjects function, 222 @unionOfSets function, 222 URL Loading System, 273–275 classes, 275 URLs (Uniform Resource Locator), 272 creating, 129 requests, 272 user experience, optimizing, 24 user interface data, decoupling, 22 mockup, 22 task manager advanced project, 165–167 V validateForInsert: method, 159 validateForInsert method, 215 validateForUpdate: method, 159 validateForUpdate method, 215 validation multi-fi eld, 215–217 single-fi eld, 213–215 validation rules, 149–150 Xcode Data Modeling tool, 158–159 value updates, KVC (key-value coding), 229–231 UIApplication object – value updates, KVC bindex.indd 373bindex.indd 373 9/17/10 7:26:13 PM9/17/10 7:26:13 PM 374 valueForKey: method, 222 valueForKey method, 220 valueForUndefinedKey: method, 220 values objects, 220 setting with KVC, 221 variables Boolean fl ag, 286 capturedCharacters, 290 char*, 41 public, 7 responseData, 275 substitution variables, 202 surveyDataArray, 99 View-based Applications template, 5 view classes, 7 View Controller loading view, 7 side-by-side display, 90 TableView and, 36 view property, 8 viewDidLoad method, 50–51, 74–75, 174, 182, 227 superclass version, 135 viewDidUnload method, 170, 190 nil property, 170 views accessory views, 88 backgroundView, 61 opaque versus transparent, 68 redrawing, 69 subviews, 57 UITableView, 6 user interface, 7 ViewTaskController, 172–173, 199 building, 173–177 rows, tapping, 167 viewWillAppear method, 174 viewWithTag method, 65 visualizing databases, 31–33 W warnings on compiling, 12 web access application, 275–276 interface, 276 Web applications, architecture, 272 Web-based services, error handling, 273 web services, 304–306 response, 318 NSURLConnection, 318–320 Result class, 320–322 XML, 322–326 REST, 307–308 SOAP messaging, 306–307 URI schemes, 307 WHERE clause, 42 windows, project window, 5–6 writing to databases, 49 X–Z Xcode, 4 downloading, 4 keyboard shortcuts, 9 organizer, 5 project window, 5–6 Xcode Data Modeling tool default values implementation, 159 Delete Rule drop-down, 152 Destination drop-down box, 151 Detail pane, 146 Confi gurations tab, 148 General tab, 147 Synchronization tab, 148–149 User Info tab, 148 entities abstract, 148 defi ning, 146–150 details, 147–149 relationships, 150–153 Entities pane, 146 Fetch Request templates, 155 valueForKey: method – Xcode Data Modeling tool bindex.indd 374bindex.indd 374 9/17/10 7:26:13 PM9/17/10 7:26:13 PM 375 interface, 146 Inverse drop-down, 151 keywords @dynamic, 158 @synthesize, 158 Properties pane, 146 Tasks application, 159–161 Transient checkbox, 150 validation rules, implementing, 158–159 XML (eXtensible Markup Language) data storage, local, 283 fi les, 283 generation sample, 292–300 libxml, 291–292 overview, 282–283 parsing, 283–285, 285–291 response, 340–342 SAX (Serial Access Parser), 284 web services response, 322–326 query response, 314 response parsing, 340–342 receiving, 338–339 RSS (Really Simple Syndication), 275 specifi cation, 282 xmlCleanupParser method, 298 xmlDocDumpFormatMemory function, 297 xmlDocPtr object, 294 xmlFreeDoc, 298 xmlNewChild function, 295 xmlNewComment function, 296–297 xmlNewDoc library function, 295 xmlNewProp function, 296 xmlNodePtr, 295 XSD (XML Schema Defi nition), 283 Xcode Data Modeling tool – XSD (XML Schema Defi nition)) bindex.indd 375bindex.indd 375 9/17/10 7:26:14 PM9/17/10 7:26:14 PM bindex.indd 376bindex.indd 376 9/17/10 7:26:14 PM9/17/10 7:26:14 PM bindex.indd 377bindex.indd 377 9/17/10 7:26:14 PM9/17/10 7:26:14 PM bindex.indd 378bindex.indd 378 9/17/10 7:26:14 PM9/17/10 7:26:14 PM . 290 char*, 41 public, 7 responseData, 275 substitution variables, 202 surveyDataArray, 99 View-based Applications template, 5 view classes, 7 View Controller loading view, 7 side-by-side display,. 159 validateForUpdate method, 215 validation multi-fi eld, 215–217 single-fi eld, 213–215 validation rules, 149–150 Xcode Data Modeling tool, 158–159 value updates, KVC (key-value coding), 229–231 UIApplication. 128–131 templates Fetch Request templates, 155 Navigation-based Application, 4 RootViewController, 94 Split View-based Application projects, 91 Tab Bar Application, 5 View-based Applications, 5 TermExtract application,

Ngày đăng: 04/07/2014, 21:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan