Introducing iOS Boilerplate A base template for iOS apps
2013-09-09 10:47
239 查看
http://iosboilerplate.com/#uitableview
It is intended to provide a base of code to start with
It is not intended to be a framework
It is intended to be modified and extended by the developer to fit their needs
It includes solid third-party libraries if needed to not reinvent the wheel
I want it now! Tweet Fork2630
At the moment iOS Boilerplate is just an XCode project. Is planned to be released as a true XCode template in the near future.
HTTP requests and an image cache (both in-memory and disk-based)
UITableViews and UITableViewCells: fast scrolling, async images, pull-down-to-refresh, swipeable cells,...
A built-in browser so your users don't leave your application when they browse to a certain URL
Maps and locations: directions between two points, autocomplete a location, etc.
library.
iOS Boilerplate also includes
been developed bysteipete.
See AsyncImageExample.m for a basic example on how to load images.
If you are interested in loading async images in a UITableView there is a complete example about async images inside UITableViewCells. SeeAsyncCellImagesExample.m
There are some examples that extend this class. See
You just need to implement something like the above code and initialize the
implement at least the UITableViewDataSource protocol. For a complete example see
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:
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
And now, to use the built-in web browser explicitly use this:
These method ensure that the object retrieved is of the desired type, otherwise return
forms with multiple text fields, or with thousands of items with no sweat!
interfaces used to enter data for them
iOS Boilerplate is developed and maintained by @gimenete
Introducing iOS Boilerplate A base template for iOS apps
What is it?
This project is inspired on HTML5 boilerplate.It is intended to provide a base of code to start with
It is not intended to be a framework
It is intended to be modified and extended by the developer to fit their needs
It includes solid third-party libraries if needed to not reinvent the wheel
I want it now! Tweet Fork2630
What is supported
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)At the moment iOS Boilerplate is just an XCode project. Is planned to be released as a true XCode template in the near future.
What's included
iOS Boilerplate includes helper classes and examples about the following topics:HTTP requests and an image cache (both in-memory and disk-based)
UITableViews and UITableViewCells: fast scrolling, async images, pull-down-to-refresh, swipeable cells,...
A built-in browser so your users don't leave your application when they browse to a certain URL
Maps and locations: directions between two points, autocomplete a location, etc.
HTTP requests & images
iOS Boilerplate includes ASIHTTPRequest AFNetworking, a great library for handling HTTP requests. SeeHTTPHUDExampleto view a simple example of how to use this
library.
iOS Boilerplate also includes
AFURLCachethat implements both in-memory and in-disk caches (great for images!). AFURLCache has
been developed bysteipete.
See AsyncImageExample.m for a basic example on how to load images.
If you are interested in loading async images in a UITableView there is a complete example about async images inside UITableViewCells. SeeAsyncCellImagesExample.m
UITableView & cells
FastCells
Inspired on this article of Atebits iOS Boilerplate includes a base class for implementing cells with fast scrolling. The base class isFastCell.
There are some examples that extend this class. See
AsyncCellImagesExample,
VariableHeightExampleand
SwipeableTableCellExample.
Pull-down-to-refresh
iOS Boilerplate includes EGOTableViewPullRefresh but simplifies its use. You can extendListViewController.
// 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]; }
You just need to implement something like the above code and initialize the
self.tableobject. 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
PullDownExample.
Swipeable cells
There is an example of how to implement a swipeable UITableViewCell extendingFastCell. Some code is also needed in the ViewController. See
SwipeableTableViewExamplefor a complete example.
Built-in web browser
Thanks to nbuggia you can now open URLs inside your application just opening them as always:[[UIApplication sharedApplication] openURL:url];
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:
[(MyApplication*)[UIApplication sharedApplication] openURL:url forceOpenInSafari:YES];
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
main.m. Put
nilinstead of @"MyApplication"
And now, to use the built-in web browser explicitly use this:
BrowserViewController *bvc = [[BrowserViewController alloc] initWithUrls:url]; [self.navigationController pushViewController:bvc animated:YES]; [bvc release];
Maps & locations
Directions
There is an example of how to calculate the directions between two points using the Google Maps API and showing it on aMKMapViewusing map overlays. See
DirectionsExample.m.
Autocomplete locations
There is an example of how to autocomplete locations using the Google Maps API. SeeAutocompleteLocationExample.m.
Other things included
JSONKit
iOS Boilerplate includes JSONKit that is a fast library for generating and parsing JSON documents.SVProgressHUD
iOS Boilerplate includes SVProgressHUD that is a simple-to-use HUD component. It is used inHTTPHUDExample
DictionaryHelper
This helper class adds some methods to theNSDictionaryclass. These methods are usful for safe manipulation of data.
- (NSString*) stringForKey:(id)key; - (NSNumber*) numberForKey:(id)key; - (NSMutableDictionary*) dictionaryForKey:(id)key; - (NSMutableArray*) arrayForKey:(id)key;
These method ensure that the object retrieved is of the desired type, otherwise return
nil. Also
NSNullis never returned. These methods are very useful when manipulating objects returned by JSONKit or any other JSON library.
StringHelper
This helper class adds some methods to theNSStringclass. The most useful are:
- (NSString*)trim;returns the original NSString but without white spaces at the beginning or at the end.
- (NSString*)urlEncode;url-encodes the original NSString.
- (NSString*)sha1;calculates the SHA1 of the given NSString.
DataHelper
This helper class adds one method to theNSDataclass. This method is
- (NSString*)hexString;and returns a NSString in hexadecimal representing the content of the original
NSDataobject.
Not included but recommended
QuickDialog
QuickDialog 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 createforms with multiple text fields, or with thousands of items with no sweat!
IBAForms
IBAForms 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 userinterfaces used to enter data for them
PSStackedView
PSStackedView: put your UIViewControllers in a stack, inspired by Twitter's iPAD UITo infinity and beyond more controls, libraries and frameworks
CocoaControls
CocoaControls Custom UI Controls for iOS and Mac OS XiOS Frameworks
iOS Frameworks A curated catalog of iOS frameworks and classes for the pragmatic iOS developeriOS Boilerplate is developed and maintained by @gimenete
相关文章推荐
- A 57x57 app icon is required for iPhone apps targeting releases of iOS prior to 7.0
- Differences Between Xcode Project Templates for iOS Apps
- iOS-Core Bluetooth Background Processing for iOS Apps(API Reference) the fifth part
- 64-bit and iOS 8 Requirements for New Apps
- Advanced Graphics and Animations for iOS Apps(session 419)
- Websites for iOS apps and OS X apps
- Continuous Integration for iOS Apps with Visual Studio Team Services
- for-each@section oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
- Core Bluetooth Background Processing for iOS Apps
- iOS---The maximum number of apps for free development profiles has been reached.
- Unity打包iOSFailed to resolve base type System.ServiceModel.Configuration.BehaviorExtensionElement for
- iOS开发中,提示信息The maximum number of apps for free development profiles has been reached
- java.lang.IllegalArgumentException: Document base D:\apache-tomcat-pointfor\webapps\manager does not
- Building iOS Apps for Enterprise Deployment
- Open Source C# (Mono Compatible) Library for Sending Push Notifications To iOS (iPhone/iPad APNS), Android (C2DM), Windows Phone Apps
- Table View Programming Guide for iOS---(一)---About Table Views in iOS Apps
- Open Source C# (Mono Compatible) Library for Sending Push Notifications To iOS (iPhone/iPad APNS), Android (C2DM), Windows Phone Apps
- iOS 8 Swift Programming Cookbook: Solutions & Examples for iOS Apps
- xcassets: A XXxXX app icon is required for iPhone apps targeting releases of iOS prior to 7.0
- iOS Boilerplate iOS应用开发模板