Last updated by at .

iOS Programming Recipe 11: Using The UITableView Part I

In most apps you’re sure to find a table view whenever a list of items needs to be presented. UITableView, similar to UIPickerView, declares both a data source and delegate protocol. The data source protocol is required while the delegate is optional. We’ll need to make use of the data source protocol for the UITableView class. For this recipe I chose to show a table view with bugs and animals shown. The bugs and animals will have seperate sections.

Assumptions

  • You are familiar with Xcode, if not familiarize yourself here.

Setting Up the View

First start with a single view controller project. Now drag a UITableView object onto the existing view from the object library and then drag a UITableViewCell onto the newly created table view. When you’re done you should have something that looks like this:

[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…]

iOS Programming Recipe 3: Creating Segues with the Storyboard Part 1

Introduction

In the early days of iOS development the Interface Builder was cumbersome and not too helpful. Now the interface builder is nicely integrated into Xcode and can be very helpful and easy to use. This article serves as an introduction into the storyboard as well as how to work with segues.

The storyboard in Xcode allows a developer to lay out the design of an App before any code has to be written. This can be helpful for conceptualizing an idea. Often a developer may want to transition between multiple scenes. To transfer between scenes with the storyboard a Segue needs to be implemented.

Asumptions

  • You Are Familiar with Xcode 4.5 if not, do so here.
  • You know how to create a project with a single view controller

The Segue

A segue is basically a connection between two views which allows one view to present another when an action(most commonly a button push) is performed. depending on the application, one of two types of segues may be used.

The Modal Segue

The modal segue is the most simple type of segue. Generally a modal segue would be used when there is no need to share information between the presenting view and the presented view. A good example of this would be a login screen.

The Push Segue

A push segue will be necessary for either the navigation controller or the tab bar controller. These types of controllers handle memory managment and help with passing data between views.

Using A Modal Segue

A modal segue is really pretty simple as far as implementation. For this example we’ll make a login screen that will take us to a view. Start of with a new single view controller project titled “modalview”.

In the main story board drag three Labels, two text fields, and a button from the objects explorer in the bottom right hand pane to the view. Then change the text on the labels and buttons to look like the following image:

iOS Login Screen Example

next drag a new view controller onto the storyboard. From the new storyboard control drag from the login button to the new view controller. When prompted choose “modal” from the dialogue.

[Read more…]

css.php
Privacy Policy