例子

例子是一些为了说明 iOS、Android 以及 OS X 的部分特性而开发的小项目。你可以方便的在你的设备上运行这些代码或者去阅读这些代码。如果您乐意,我们非常希望您可以向我们的例子代码库贡献代码。

iOS logo

iOS

 

Beers

Lists locations on a map and table, and display their Wikipedia page in a web view.

tab bar table view map view web view

Camera

Displays the image picker in order to take a picture with the camera.

image picker

CircleLayout

Uses collection views to pack and present subviews.

collection view

Email

Displays the mail composer UI within the app.

message UI

FlappyBird

An implementation of the popular game.

sprite kit

Fonts

Lists all system fonts in a table view.

table view font

GestureTable

Builds a table view controlled by custom gestures for edition.

table view table view cell gestures

Hello

Displays Hello World with custom drawing effects upon touch.

custom view touches

HelloGL

A GlKit/OpenGL sample app.

glkit

Locations

Takes the current location and saves it into Core Data.

table view core location core data

MoveMe

Moves a custom view with gestures and core animation.

drawing touches core animation

Mustache

Detects faces in a picture and adds mustaches on them.

image face recognition gestures

Paint

Draws paths following move gestures, clears the view upon shake.

custom view drawing bezier path gestures audio player

PaintHTML

Builds a web-based paint canvas with a web view and HTML/Javascript.

web view javascript

RedditSearch

Searches Reddit and displays results in a custom table view.

table view table view cell grand central dispatch networking json

SpaceRocks

A simple SpriteKit game, demonstrating the use of scenes, nodes and physics bodies.

sprite kit

StoryboardCustoms

Integrates Interface Builder's Storyboards in an app.

storyboard

TicTacToe

A version of the popular Tic-tac-toe game written using custom views and touch events.

touches

Timer

A timer app that refreshes a counter every 0.1 seconds.

timer

Trollify

How to retrieve an image from the camera roll and layer another image on top of it with a gesture.

image image picker camera roll action sheet gestures

Android logo

Android

 

Conference

An app with a navigaton drawer, custom list views and map view via Google Play Services.

linear layout list view map view navigation drawer

Hello

Displays Hello World with custom drawing effects upon touch.

touches

Paint

Draws paths following move gestures.

linear layout canvas draw

ServiceDemo

An Android service playing a background music.

service media player

States

Shows all US states in a list and opens their Wikipedia page on tap.

list view web view

Timer

A timer app that refreshes a counter every 0.1 seconds.

linear layout timer

Weather

An app that uses Google's networking framework Volley to fetch and parse a JSON feed.

networking json

WebViewDemo

An app that exposes an object to an HTML/Javascript backend via a web view.

web view javascript

OS X logo

OS X

 
 

Calc

A simple calculator that makes use of the #eval method.

custom view eval

 

CircleView

Shows how to customize text layout and drawing within a timer-based custom view.

custom view events affine transform text layout timer

 

DotView

Draws a simple dot shape using bezier paths.

custom view events bezier path

 

FileSystemBrowser

Presents the file system entries in an outline view (tree list).

outline view

 

FlickrBrowser

Searches Flickr's Atom feed and displays results in an image browser view.

image kit pub sub grand central dispatch notifications

 

ImageTransition

Demonstrates core image transitions.

core image core animation

 

Markdown

Converts a Markdown file into HTML and presents it into a web view.

webkit vendoring

 

NSTableViewBinding

Shows how to populate a table view with Cocoa bindinds.

table view bindings

 

PagePacker

A fully-featured booklet creation app demonstrating a lot of Cocoa concepts.

pdf kit custom view dragging scripting undo manager notifications

 

PathDemo

Demonstrates various bezier path drawings in a custom view that can also be printed.

bezier path custom view drawing print

 

RssReader

Lists the content of a remote RSS file in a table view.

table view xml grand central dispatch

 

Scenario

A SceneKit app.

auto layout scene kit toolbar grand central dispatch

 

Temperature Converter

A form-based app that converts and formats different units.

form bindings value transformer number formatter user defaults