English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

iOS 7 Open Source Bleeding Edge

Views and View Controllers

--In this Chapter:--

  • Introduction

----

Introduction

It's no coincidence we are kicking off our tour of the iOS open source community of libraries, with a look at UIViewController and UIView-related APIs. View Controllers and Views provide the visual interface between your clients and your application, with the view controller's role orchestrating a list of participating views, whilst bridging communications with the model aspect of the model-view-controller paradigm.

Whilst Apple have done a great job with UIViewController and it's derivative classes, we will be looking at specific types of View Controllers, from a modern navigation controller, to more functional and aesthetically pleasing table views. You will get a  sample of UIViewController transition-helpers, to give your app a unique touch. 


MGSplitViewController

(Courtesy: CocoaControls.com)Description: 

MGSplitViewController is a replacement for UISplitViewController, with various useful enhancements.

CocoaPods:   pod 'MGSplitViewController', '~> 1.0.0'

Github Watchers: 1375

Forks: 358

Ease to implement: 

URL: https://github.com/mattgemmell/MGSplitViewController

Usage:

Follow the included project sample, which demonstrates how to work with the imported MGSplitViewController.h 

Notes:

This library is a drop-in replacement for UISplitViewController, in both behaviour and what delegates to expect, with the additional functionalities of being able to view/hide the master view controller, choose how to present the master/detail relationship, whether the split view is horizontal or vertical. You can also control whether the divider is draggable. 

 

 


MHNatGeoViewControllerTransition

Description: 

A UIViewController transition effect, inspired by City Guides (National Geographic).

CocoaPods:   pod 'MHNatGeoViewControllerTransition', '~> 1.0.0'

Github Watchers: 470

Forks: 53

Ease to implement: ✮✮✮

URL: https://github.com/michaelhenry/MHNatGeoViewControllerTransition

Usage:

Once you import the project (refer to sample project), you can use a Storboard Segue to define the 'nat geo' action segue, or opt to implement the transition programmatically, by importing "MHNatGeoViewControllerTransition.h" and then working with it using it's exposed block: 

[self dismissNatGeoViewControllerWithCompletion:
 ^(BOOL finished) { NSLog(@"Dismiss complete!"); }];


Notes:

If you want a bit of a different transitional appearance when your app navigates between View Controllers, or down a UITableView hierarchy, this popular library is inspired by National Geographic's own app, to provide a card-like transition. Use this effect delibrately in certain screens, based on your UX intent, as it can be a bit heavy if used across your app.   

 


UIViewController+KNSemiModal Category

Description: 

A category helper library class, producing a semi-modal view along with a smooth animation presented, and to implement it couldn't be any simpler. 

CocoaPods:   pod 'KNSemiModalViewController', '~> 0.3'

Github Watchers: 1108

Forks: 72

Ease to implement: ✮✮✮

URL: https://github.com/kentnguyen/KNSemiModalViewController

Usage:

As it's a category, once you import the class into your project, you don't have to do anything, you don't need to sub-class or anything. You simply call [self presentModalView:myView] and you have yourself a semi-modal view.

Notes:

This library is fully ARC-compliant, taking care of all the nitty gritty tasks of adjusting it's frame size, touch zones and even supports landscape view. There is iPad support as well, although at this stage, it's quite experimental according to the author. The author also exposes various parameters to further define and customise    

 

 

 


BDDynamicGridViewController

Description: 

A fancy grid-like display of a UIView list, where the library automatically lays out the views in a beautiful dynamic way. 

CocoaPods:   pod 'BDDynamicGridViewController', '~> 0.0.4'

Github Watchers: 475

Forks: 109

Ease to implement: ✮✮

URL: https://github.com/norsez/BDDynamicGridViewController

Usage:

You would first need to copy the header and implementation files into your project, or use cocoapods. You would then initialise the view controller, and make use of BMDynamicGridDelegate, similar to how you would work with a UITableView. You set the numberOfViews, ViewAtIndex, and so forth.

Notes:

Although working with UICollectionView does a similar job, this library does provide a few more things for free, to allow you to get the visual presentation you want. The library does provide some useful exposed methods, to set how many views per row, the maximum number, set specific row height and so forth, which is straight forward. Usage is a bit more involved, as you are accustomed to with UITableViews, but that is to be expected. 


 


JSMessagesViewController

Description: 

An iMessage-like messagging View Controller, with almost identical functionality as the native iPhone messaging controller.

CocoaPods:   pod 'JSMessagesViewController', '~> 4.0.2'

Github Watchers: 1336

Forks: 303

Ease to implement: ✮✮

URL: https://github.com/jessesquires/MessagesTableViewController

Usage:

You use cocoapods or drag the JSMessageViewController/ folder into your project, along with the JSQSystemSoundPlayer component. The main thing is to subclass JSMessageViewController, and conform to both the JSMessageViewDelegate and JSMessageViewDataSource protocols, which is essentially a derivative of the UITableView class. 

Notes:

Self-described, the JSMessgeViewController provides almost all of the iMessage functionality, and works for both iPhone and iPad, with a lot of features out of the box. For instance, you get time and date detectors, sound effects for sending, avatars and messaging copy/paste.




MCSwipeTableViewCell

Description: 

A customised UITableViewCell that has is synonimous with apps like Mailbox, where you can swipe to confirm or delete. 

CocoaPods:   pod 'MCSwipeTableViewCell', '~> 2.1.0'

Github Watchers: 1612

Forks: 282

Ease to implement: ✮✮

URL: https://github.com/alikaragoz/MCSwipeTableViewCell

Usage:

You use cocoapods or drag the project header and implementation files into your project. Following Apple's design principles for working with UITableViews and UITableViewCells, you implement the custom TableViewCell class and work with it's exposed properties. The library also exposes a couple of delegates:

#pragma mark - MCSwipeTableViewCellDelegate

// Called when the user starts swiping the cell.
- (void)swipeTableViewCellDidStartSwiping:(MCSwipeTableViewCell *)cell;

// Called when the user ends swiping the cell.
- (void)swipeTableViewCellDidEndSwiping:(MCSwipeTableViewCell *)cell;

// Called during a swipe.
- (void)swipeTableViewCell:(MCSwipeTableViewCell *)cell didSwipeWithPercentage:(CGFloat)percentage;

 

Notes:

For developers looking to develop either a task/checklist app, or any sort of table-intensive view, having some intuitive actions you can do on cells besides sliding right ot left, allows you to provide extra functionality without the cost of extra real-estate. 

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.