Last updated by at .

iOS Programming Recipe 14: Implementing A UICollectionViewController

UICollectionView is great for displaying information in a grid or other custom layouts. In iOS 6 you’ll see collection views most likely used in many apps such as the podcasts app for viewing different podcasts. Since in most cases you’ll want to use UICollectionViewController, we’ll focus on that for this recipe.

Assumptions

  • You are familiar with Xcode and setting up a single view controller. If not check out our recipe on Xcode¬†first.

Setting Up The View

Go ahead and create a new single view controller project. I titled mine “CollectioViewFun”. When the project opens up, You’ll want to delete the single view controller from the storyboard and drag a new collection view controller in it’s place. This should look like the following:

CollectionViewController

Now since our class type has changed from a standard view controller to a collection view controller we’ll want to change the class type in the viewController.h file as well. Go ahead and change the class name from ViewController to CollectionViewController as well. Don’t forget to change all instances of the term “ViewController” in both the .m and .h files:

[Read more…]

iOS Programming Recipe 7: Using the UIPickerView

The UIPickerView can be a frustrating element for a new iOS programmer. I know first hand as I was just recently there.

For this example I’m going to create a simple color picker. from the picker we can select a color and the RGB value will print to the screen. Seems easy enough? right? Let’s get to it!

Assumptions

  • You Are familiar with Xcode and the storyboard
  • you know how to create a single view controller

Setting up the Storyboard

First start out with a single view controller and title it whatever you like. I titled mine “PickIt”.

From the Storyboard drag a new UIPickerView object on to the view from the Object Library in the bottom right hand corner of the screen.

Create some new labels titled “Color Picker”, “You Chose:”, and “Nothing”. Arrange all of these elements as seen on the scren below. Optionally you can choose a background for your view too.

[Read more…]

css.php
Privacy Policy