Skip to content

Instantly share code, notes, and snippets.

@fcanas
fcanas / UI Components Rundown
Last active August 29, 2015 14:03
iOS Major UI Components Rundown and Resources
# Overview
Apple provides a good [introduction to view controllers](https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007457) that starts off very general and proceeds to highly technical. The introduction is probably worth reading for anyone interacting with iOS developers (_e.g._ designers and product managers. Next, I would look at a [catalog](https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Introduction.html#//apple_ref/doc/uid/TP40011313) of the "container" view controllers they encourage you to use.
# Table Views
The [table view](https://developer.apple.com/library/ios/documentation/userexperience/conceptual/tableview_iphone/AboutTableViewsiPhone/AboutTableViewsiPhone.html) is one of the heaviest hitters in iOS. It's been around since the beginning, is dead-simple to use and is _highly_ customizable.
See also UITableViewCells
# Collection Views
Collection views
@fcanas
fcanas / gist:4324891
Created December 18, 2012 04:02
Property changes and control events are different. A reminder from testing in Cocoa.

Here's a lesson I learned testing UI components in Cocoa Touch on FCSettingsBooster.

Let's say you have some UISwitch element that you wire up programmatically:

[_theSwitch addTarget:self action:@selector(setDefaults) forControlEvents:UIControlEventValueChanged];

And you're going to try and make sure that some eventual effect is triggered by chaning the UISwitch. The fact that the setDefaults selector is called is irrelevant. In this case, we want to ensure that a completion block is called. You might think you can test it as follows: