Stanford iOS7 Open Class 11 notes and Demo & access HTTPS link to download data, Stanford ios7
This section mainly introduces UITableView and iPad. The Demo downloads and displays images from Flicker. However, in the actual process, it is found that FQ is required and HTTPS is used. Therefore, two demos are used this time, one is the Demo in the course, and the other is simplified.
In the final debugging process, I also found a tips to observe variables in Xcode.
I. UITableView
UITableView is the most common table view in iOS. Every option in contacts and mobile phone settings in the address book is a cell in the table view, and every record on Weibo is actually a cell, it's just more components.
(1) two important protocols
UITableViewDataSource and UITableViewDelegate are two important protocols in UITableView (which can be understood as interfaces). The former is used to control the cell data source, including two required ones: specify the number of cells and the number of groups. Other operations such as deleting and moving are also implemented in this Protocol.
UITableViewDelegate. This Protocol provides a series of methods for user interaction with UITableView, such as the most commonly used response method for click cells.
(2) cell Reuse
To save resources, iOS will reuse the cell. There is a separate place to store the cell that is removed from the screen. When sliding up the UITableView, if there is a reusable cell in the queue, you can use the cell directly. Note that there is a restriction for reuse, that is, the cell style is the same.
2. iPad-specific controls
There are two commonly used UI controls in the iPad. the pop-up window UIPopoverController and the directory-content combination control UISplitViewController. This course introduces the latter. UISplitViewController consists of two views, one of which is the directory view master, one is the content view detail. The Demo displays the image name through the UITableView in the master, and then loads the corresponding image in the content View detail.
There are two points worth noting:
(1) Determine whether the device is an iPhone or iPad based on the unique control of UISplitViewController for the iPad. The default value 0 of UISplitViewController is the master Directory view, and 1 is the detail content view, if you cannot obtain the content view, the device is the iPhone, and the iPad.
(2) The UISplitViewController protocol provides methods to solve the problem of whether the master view is displayed on the horizontal and vertical screens. Note that UISplitViewControllerDelegate is special and needs to be set before viewDidLoad.
Iii. Summary of Demo process issues
Currently, Flicker is blocked, so FQ access is required. You only need to register the key of the Request API. The verification result shows that only access is allowed through HTTPS. Therefore, the addresses in FilckerFetcher are changed to HTTPS.
The downloaded data is always nil, and an error is reported indicating that the data is empty. Check that + dataWithContentsOfURL cannot be used when requesting HTTPS connection, because security authentication cannot be set, for HTTPS connections, security authentication must be configured. Otherwise, the request fails and no data is available.
Reference: http://stackoverflow.com/questions/14013307/datawithcontentsofurl-ios-https-self-signed-certificate
NSURLConnection is used to enable the client to ignore certificate verification.
Refer:Http://www.cnblogs.com/stan0714/archive/2012/03/21/2409872.html
There are other methods that are not tried. This method is said to be not allowed by Apple and may cause problems when submitting applications.
Http://stackoverflow.com/questions/19394628/cant-receive-json-request-via-https-due-to-untrusted-certificate
Another problem is that an error is reported when the image data is obtained. This is because the image is not received completely, and a small part of the image is displayed on the screen and disappears immediately, the reason is that only some data is accepted before, the image is converted immediately, and the main thread is notified to update the UI.
In fact, the data should be fully received before subsequent operations, because the data may need to be completely transmitted multiple times.
The same problem also appeared later when obtaining the json data of the image list (the data was obtained exactly once, but I did not pay attention to the processing)
4. debugging tips
You can use the mouse to select a variable or observe the variable below, but it is always inconvenient. During breakpoint debugging, you can enter the "po variable name" in the output window to observe the variable assignment.
Demo effect:
Currently, there are bugs in the full Demo click cell. You are welcome to solve the problem and tell the reason. If there is any update, it will be added in time.
Download simplified DemoDownload the full Demo
How to restore the firmware when the iphone enters recovery mode
Download the ios5.1.1 firmware online. Then select shift + restore in itunes.
Maybe you have not recovered the data line.