Đang chuẩn bị liên kết để tải về tài liệu:
Phát triển ứng dụng cho iPhone và iPad - part 35

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 35', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Example 1 Location-Based Search 309 You will be using these frameworks in your LocationSearchViewController class. Therefore you will need to import the headers for these frameworks in the LocationSearchViewController.h header. Add the following import statements to the LocationSearchViewController.h header file Available lor download on Wrnx.cnm import MapKit MapKit.h import CoreLocation CoreLocation.h LocationSearchViewController.h The user interface for the application consists of a search bar to accept the search criteria from the user and a map view that you will use to display the search results. Because you need access to both of these interface items in your code you will need to add instance variables and outlets for these elements. In the LocationSearchViewController.h header add instance variables for an MKMapView called mapView and a UISearchBar called searchBar to the interface definition Available for download on Wrox.com MKMapView mapView UISearchBar searchBar LocationSearchViewController.h Now that you have declared your instance variables declare IBOutlet properties for these UI elements so that you have access to them in Interface Builder Available lor download on Wrnx.cnm property property nonatomic retain IBOutlet MKMapView mapView nonatomic retain IBOutlet UISearchBar searchBar LocationSearchViewController.h Next you will move into the implementation file LocationSearchViewController.m. You first need to synthesize your two new properties. Add a line to synthesize the mapView and searchBar properties to the implementation synthesize mapView searchBar Finally any time that you use a property that retains its value you need to clean up the memory used by the property in the dealloc and viewDidUnload methods. Add the code to set the outlet properties to nil in the viewDidUnload method Available for download on Wrox.cnm - void viewDidUnload Release any retained subviews of the main view. e.g. self.myOutlet nil self.mapView nil self.searchBar nil .