Skip to content

Instantly share code, notes, and snippets.

@xandrucea
Last active December 16, 2015 05:59
Show Gist options
  • Save xandrucea/5388386 to your computer and use it in GitHub Desktop.
Save xandrucea/5388386 to your computer and use it in GitHub Desktop.
Explanation about content of downloaded sample projects from apple
Advanced Sample Project
------------------------------
https://developer.apple.com/library/ios/#samplecode/AdvancedTableViewCells/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009111
AdvancedTableViewCells includes three different cells that all display content in the same form as the App Store application. One uses individual subviews (image views, labels, etc.) to display the content. Another uses a single view that draws all of the content. A third uses a single view to draw most of the content and separate views for the remainder.
International Mountains
------------------------------
https://developer.apple.com/library/ios/#samplecode/InternationalMountains/Introduction/Intro.html
Drawing from the existing Cocoa Internationalization Mountains sample, this sample shows how to integrate, design and programmatically access localized resources and data in an iPhone application. This sample uses multiple localized views, localized formatted strings, localized application data, localized info.plist strings, and a localized application preferences settings bundle. The sample is localized in three languages: English, French, and Traditional Chinese.
TableViewSuite
------------------------------
https://developer.apple.com/library/ios/#samplecode/TableViewSuite/Introduction/Intro.html
This sample shows how to use UITableView through a progression of increasingly advanced applications that display information about time zones.
The first example shows a simple list of the time zone names. It shows how to display a simple data set in a table view.
The second example shows the time zones split into sections by region, with the region name as the section heading. It shows how to create an indexed table view.
The third example shows the time zones split into sections alphabetically, with the first letter of their locale name as the section heading. It shows how to set up a table view to display an index.
When implementing a table view cell, there's a tension between optimal scrolling performance and optimal edit/reordering performance. You should typically use subviews in the cell's content view.
When you have an edit or reordering control, using subviews makes the implementation easier, and the animations perform better because UIKit doesn't have to redraw during animations.
Subviews have two costs:
1) Initialization. This can be largely mitigated by reusing table cells. 2) Compositing. This can be largely mitigated by making the views opaque. Often, one translucent subview is fine, but more than one frequently causes frame drops while scrolling.
If the content is complex, however (more than about three subviews), scrolling performance may suffer. If this becomes a problem, you can instead draw directly in a subview of the table view cell's content view.
The fourth example displays more information about each time zone, such as the time and relative day in that time zone. Its main aim is to show how you can customize a table view cell using subviews. It also introduces custom classes to represent regions and time zones to help reduce the overhead of calculating the required information -- these are also used in the fifth example.
The fifth example is an extension of the fourth. It displays even more information about each time zone, such as the time and relative day in that time zone. Its shows how you can create a custom table view cell that contains a custom view that draws its content in -drawRect:
Tweeting
------------------------------
https://developer.apple.com/library/ios/#samplecode/Tweeting/Introduction/Intro.html
By using the Twitter framework, Accounts framework, and the NSJSONSerialization class, this sample demonstrates using the built-in Twitter composition sheet, creating a custom POST request, and downloading the public timeline from Twitter.
The "Send Easy Tweet" button checks if a Twitter account is present on the device and creates a pre-populated TWTweetComposeViewController. This also handles the "cancel" and "send" actions from the TWTweetComposeViewController.
The "Send Custom Tweet" button utilizes the Accounts framework to create an instance of the account store on the device and then find all Twitter accounts present. In this example, the first Twitter ACAccount object found is used to pre-populate a tweet and uses a TWRequest to post the tweet using the Twitter API. This example also handles the returned response data and http response.
The "Get Public Timeline" button creates a TWRequest to get the current public timeline using the Twitter API. The response data is then converted from JSON data to an NSDictionary, using the NSJSONSerialization class.
UICatalog
------------------------------
https://developer.apple.com/library/ios/#samplecode/UICatalog/Introduction/Intro.html
This sample is a catalog exhibiting many views and controls in the UIKit framework, along with their various properties and styles.
If you need code to create specific UI controls or views, refer to this sample and it should give you a good head start in building your user interface. In most cases you can simply copy and paste the code snippets you need.
When images or custom views are used, accessibility code has been added. Using the iPhone Accessibility API enhances the user experience of VoiceOver users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment