Files
iOS-boilerplate/index.html
Alberto Gimeno Brieba f9f4b54976 Mobile support
2011-11-07 12:36:46 +01:00

379 lines
14 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
<title>iOS Boilerplate - A base template for iOS apps</title>
<!--
<meta name="description" content="">
<meta name="author" content="">
<meta name="robots" content="">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
-->
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css">
<style>
html{overflow-y:scroll}
body{padding-top:60px; background-image: url(stucco.png)}
.wrapper{background-color:white; margin: 0 auto; width: 980px; padding: 20px 0;
box-shadow: 0px 0px 15px #aaa;}
@media only screen and (min-width: 768px) and (max-width: 991px) {
.wrapper { width: 740px; }
.container { width: 700px; }
img { max-width: 700px; }
#ribbon, .topbar, h1 small, h2 small { display:none; }
.row > [class*="span"] { max-width: 700px; }
body { padding-top: 0;}
}
@media only screen and (max-width: 767px) {
.wrapper { width: 280px; }
.container { width: 240px; }
#ribbon, .topbar, h1 small, h2 small { display:none; }
.row > [class*="span"] { width: 240px; }
img { max-width: 240px; }
body { padding-top: 0; }
}
</style>
</head>
<body>
<a id="ribbon" href="https://github.com/gimenete/iOS-boilerplate"><img style="position: fixed; top: 40px; right: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/30f550e0d38ceb6ef5b81500c64d970b7fb0f028/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub"></a>
<div class="topbar">
<div class="fill">
<div class="container fixed">
<h3><a href="index.html">iOS Boilerplate</a></h3>
<ul>
<li><a href="#http-requests">HTTP requests &amp; images</a></li>
<li><a href="#uitableview">UITableView &amp; cells</a></li>
<li><a href="#maps">Maps &amp; locations</a></li>
<li><a href="#browser">Builtin browser</a></li>
<li><a href="#others">Other things included</a></li>
</ul>
</div>
</div>
</div>
<div class="wrapper">
<div class="container">
<div class="page-header">
<h1>Introducing iOS Boilerplate <small>A base template for iOS apps</small></h1>
</div>
<div class="row">
<div class="span9 columns">
<h2>What is it?</h2>
<p>This project is inspired on <a href="http://html5boilerplate.com">HTML5 boilerplate</a>.</p>
<ul>
<li>It is intended to provide a base of code to start with</li>
<li>It is not intended to be a framework</li>
<li>It is intended to be modified and extended by the developer to fit their needs</li>
<li>It includes solid third-party libraries if needed to not reinvent the wheel</li>
</ul>
<p>
<a class="btn primary large" href="https://github.com/gimenete/iOS-boilerplate">I want it now!</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="gimenete" data-lang="en">Tweet</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://github.com/gimenete/iOS-boilerplate"
class="gitforked-button gitforked-watchers">Fork</a>
</p>
<br>
<h2>What is supported</h2>
<p>
iOS Boilerplate is tested on iPhone / iPod Touch devices with iOS 4.0 or greater.
In the future it might support universal applications (iPhone + iPad)
</p>
<p>
At the moment iOS Boilerplate is just an XCode project. Is planned to be released
as a true XCode template in the near future.
</p>
<br>
<h2>What's included</h2>
<p>iOS Boilerplate includes helper classes and examples about the following topics:</p>
<ul>
<li>HTTP requests and an image cache (both in-memory and disk-based)</li>
<li>UITableViews and UITableViewCells: fast scrolling, async images, pull-down-to-refresh, swipeable cells,...</li>
<li>A built-in browser so your users don't leave your application when they browse to a certain URL</li>
<li>Maps and locations: directions between two points, autocomplete a location, etc.</li>
</ul>
</div>
<div class="span4 columns">
<img src="img/async-images.png">
</div>
</div>
<section id="http-requests"><br><br><br>
<div class="row">
<div class="span16 columns">
<div class="page-header">
<h2>HTTP requests &amp; images</h2>
</div>
<p>
iOS Boilerplate includes <strike>ASIHTTPRequest</strike>
<a href="https://github.com/gowalla/AFNetworking">AFNetworking</a>,
a great library for handling HTTP requests. See <code>HTTPHUDExample</code>
to view a simple example of how to use this library.
</p>
<p>
iOS Boilerplate also includes
<a href="https://github.com/steipete/AFNetworking/blob/disk-cache/AFNetworking/AFRestClient.h">
<code>AFURLCache</code></a> that implements both in-memory and in-disk caches (great for images!).
AFURLCache has been developed by <a href="https://github.com/steipete">steipete</a>.
</p>
<p>
See
<a href="https://github.com/gimenete/iOS-boilerplate/blob/master/IOSBoilerplate/AsyncImageExample.m">AsyncImageExample.m</a> for a basic example on how to load images.
</p>
<p>
If you are interested in loading async images in a UITableView there is a complete example about async images inside UITableViewCells. See
<a href="https://github.com/gimenete/iOS-boilerplate/blob/master/IOSBoilerplate/AsyncCellImagesExample.m">AsyncCellImagesExample.m</a>
</p>
</div>
</div>
</section>
<section id="uitableview"><br><br><br>
<div class="row">
<div class="span9 columns">
<div class="page-header">
<h2>UITableView &amp; cells</h2>
</div>
<h3>FastCells</h3>
<p>Inspired on <a href="http://blog.atebits.com/2008/12/fast-scrolling-in-tweetie-with-uitableview/">this article of Atebits</a>
iOS Boilerplate includes a base class for implementing cells with fast scrolling. The base class is
<code>FastCell</code>. There are some examples that extend this class. See
<code>AsyncCellImagesExample</code>, <code>VariableHeightExample</code> and
<code>SwipeableTableCellExample</code>.
</p>
<h3>Pull-down-to-refresh</h3>
<p>
iOS Boilerplate includes <a href="https://github.com/enormego/EGOTableViewPullRefresh">EGOTableViewPullRefresh</a> but simplifies its use.
You can extend <code>ListViewController</code>.
</p>
<pre>// This is the core method you should implement
- (void)reloadTableViewDataSource {
_reloading = YES;
// Here you would make an HTTP request or something like that
// Call [self doneLoadingTableViewData] when you are done
[self performSelector:@selector(doneLoadingTableViewData) withObject:nil afterDelay:3.0];
}</pre>
<p>
You just need to implement something like the above code and initialize the
<code>self.table</code> object. You can initialize it with InterfaceBuilder
(drop a UITableView component and make the link between the outlet and the component).
You should also implement at least the UITableViewDataSource protocol.
For a complete example see <code>PullDownExample</code>.
</p>
<h3>Swipeable cells</h3>
<p>
There is an example of how to implement a swipeable UITableViewCell extending
<code>FastCell</code>. Some code is also needed in the ViewController. See
<code>SwipeableTableViewExample</code> for a complete example.
</p>
</div>
<div class="span4 columns">
<img src="img/pull-down.png">
</div>
</div>
</section>
<section id="browser"><br><br><br>
<div class="row">
<div class="span9 columns">
<div class="page-header">
<h2>Built-in web browser</h2>
</div>
<p>Thanks to <a href="https://github.com/nbuggia">nbuggia</a> you can now open URLs inside
your application just opening them as always:</p>
<pre>[[UIApplication sharedApplication] openURL:url];</pre>
<p>A new viewController will be shown without exiting your app.
However, what happens if you really need to open a URL in Safari? No worries, just use
this method instead:</p>
<pre>[(MyApplication*)[UIApplication sharedApplication] openURL:url forceOpenInSafari:YES];</pre>
<p>What if you don't want this to be the default behaviour? What if you want to open
URLs by default in Safari? Just edit
<code>main.m</code>. Put <code>nil</code> instead of @"MyApplication"</p>
<p>And now, to use the built-in web browser explicitly use this:</p>
<pre>BrowserViewController *bvc = [[BrowserViewController alloc] initWithUrls:url];
[self.navigationController pushViewController:bvc animated:YES];
[bvc release];</pre>
</div>
<div class="span4 columns">
<img src="img/web-browser.png">
</div>
</div>
<section id="maps"><br><br><br>
<div class="row">
<div class="span9 columns">
<div class="page-header">
<h2>Maps &amp; locations</h2>
</div>
<h3>Directions</h3>
<p>
There is an example of how to calculate the directions between two points using the
Google Maps API and showing it on a <code>MKMapView</code> using map overlays.
See <code>DirectionsExample.m</code>.
</p>
<h3>Autocomplete locations</h3>
<p>
There is an example of how to autocomplete locations using the
Google Maps API.
See <code>AutocompleteLocationExample.m</code>.
</p>
<br>
<img src="img/autocomplete.png">
</div>
<div class="span4 columns">
<img src="img/directions.png">
</div>
</div>
</section>
<section id="others"><br><br><br>
<div class="page-header">
<h2>Other things included</h2>
</div>
<div class="row"> <div class="span16 columns">
<h3>JSONKit</h3>
<p>
iOS Boilerplate includes <a href="https://github.com/johnezang/JSONKit">JSONKit</a> that is
a fast library for generating and parsing JSON documents.
</p>
<h3>SVProgressHUD</h3>
<p>
iOS Boilerplate includes <a href="https://github.com/samvermette/SVProgressHUD">SVProgressHUD</a> that is
a simple-to-use HUD component. It is used in <code>HTTPHUDExample</code>
</p>
<h3>DictionaryHelper</h3>
<p>
This helper class adds some methods to the <code>NSDictionary</code> class. These methods
are usful for safe manipulation of data.
</p>
<pre>- (NSString*) stringForKey:(id)key;
- (NSNumber*) numberForKey:(id)key;
- (NSMutableDictionary*) dictionaryForKey:(id)key;
- (NSMutableArray*) arrayForKey:(id)key;</pre>
<p>
These method ensure that the object retrieved is of the desired type, otherwise return <code>nil</code>.
Also <code>NSNull</code> is never returned. These methods are very useful when manipulating
objects returned by JSONKit or any other JSON library.
</p>
<h3>StringHelper</h3>
<p>
This helper class adds some methods to the <code>NSString</code> class. The most useful are:
</p>
<p>
<code>- (NSString*)trim;</code> returns the original NSString but without white spaces at
the beginning or at the end.
</p>
<p>
<code>- (NSString*)urlEncode;</code> url-encodes the original NSString.
</p>
<p>
<code>- (NSString*)sha1;</code> calculates the SHA1 of the given NSString.
</p>
<h3>DataHelper</h3>
<p>
This helper class adds one method to the <code>NSData</code> class. This method is
<code>- (NSString*)hexString;</code> and returns a NSString in hexadecimal representing
the content of the original <code>NSData</code> object.
</p>
</div></div>
</section>
<section id="not-included"><br><br><br>
<div class="page-header">
<h2>Not included but recommended</h2>
</div>
<div class="row"> <div class="span16 columns">
<h3>QuickDialog</h3>
<p>
<em><a href="https://github.com/escoz/QuickDialog">QuickDialog</a> allows you to create HIG-compliant iOS forms for your apps without having to directly deal with UITableViews, delegates and data sources. Fast and efficient, you can create forms with multiple text fields, or with thousands of items with no sweat!</em>
</p>
<h3>IBAForms</h3>
<p>
<em><a href="https://github.com/ittybittydude/IBAForms">IBAForms</a> is a framework for building data entry screens on the iPhone. You can quickly make forms using the built-in form field types or create your own custom fields and the user interfaces used to enter data for them</em>
</p>
<h3>PSStackedView</h3>
<p>
<em><a href="https://github.com/steipete/PSStackedView">PSStackedView</a>: put your UIViewControllers in a stack, inspired by Twitter's iPAD UI</em>
</p>
</div>
</div>
</section>
<section id="infinite"><br><br><br>
<div class="page-header">
<h2>To infinity and beyond <small>more controls, libraries and frameworks</small></h2>
</div>
<div class="row"> <div class="span16 columns">
<h3>CocoaControls</h3>
<p>
<a href="http://cocoacontrols.com/">CocoaControls</a> Custom UI Controls for iOS and Mac OS X
</p>
<h3>iOS Frameworks</h3>
<p>
<a href="http://iosframeworks.com/">iOS Frameworks</a> A curated catalog of iOS frameworks and classes for the pragmatic iOS developer
</p>
</div>
</section>
<footer>
<p>iOS Boilerplate is developed and maintained by <a href="http://twitter.com/gimenete">@gimenete</a></p>
</footer>
</div>
</div>
<script src="http://gitforked.com/api/1.1/button.js" type="text/javascript"></script>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</body>
</html>