Short solution for short problems

U2U Course: Developing iPad apps with Apple iOS SDK and Xcode

Soon I get the chance via my job to follow the course at U2U. It will be one week training. Looking forward to that.

This is the course outline:

iOS and the structure of an iOS App

The iOS platform enables radically different ways of using software. We will introduce iOS as platform for building mobile applications, and discuss the design patterns needed to create an application that conforms to the Apple User Interface Design guidelines.

Layers of iOS
Limitations of the mobile platform
Native vs web apps
Access to hardware and software
One active application and one window
Limited access, response time, screen size, system resources
The iOS SDK, the APIs and frameworks

XCode, Interface Builder and iOS Simulator

In this module you will explore the capabilities of XCode, Interface Builder and the iOS Simulator, the tools to be used as iOS developer.

Code Samples
Finding documentation
iOS Simulator
Interface Builder

iOS App building blocks

We will build a first iOS app and explore how code should be structured and discover the responsibilities of all different components. Cocoa Touch will be introduced in this module as the programming framework driving user interaction on iOS.

Design Patterns, especially the Model-View-Controller pattern
Introduction to application delegates
Outlets and actions
Using Views
Adding views dynamically
View Hierarchy
View based application templates
View controllers
Working with storyboards

UI Controls

This module introduces the widgets and controls used to build the user interface.

Active and Passive Controls
Image View and Text Fields
The Touch Keyboard
Slider and Label
Switches, Button, Segmented Control
Action Sheet, Alert View

Autorotation and Autosizing

You'll learn how to make optimal use of the limited available screen estate, for example when the user switches form portrait to landscape view...

Responding to device rotations
Programmatically rotating the screen
Autosize Attributes
Xcode struts and springs
Using the new Xcode AutoSize

Multi view applications

If one view can no longer contain all the information that you want to show, extra views can become necessary. We discuss how to switch between content views.

Architecture of a multi view application
Using the NavigationViewController
Performing segues
Animating transitions

Tab Bars and Pickers

The user interface often has to be designed to support a multi view apps, including switching tabs to change the view.

Selecting values with a Picker Control
Delegates and Data Sources
Tab Bar framework
Using pickers to select values from a predefined set of values.
Date Picker, Single-component picker, Multi-component Picker
Dependency between components
Creating a custom picker

Table Views and Navigation Controllers

A table view presents a scrollable list of items that may be divided into sections, and are often used for hierarchical navigation.

Table View Styles
The Table View API
Table-View Cells
Managing Selections
Inserting rows and deleting selections
Search Bar
Navigating through complex hierarchies
Objects of a navigation interface
Navigation controllers
Navigation stack
Navigation toolbars

iPad Considerations

You'll explore the additional UIKit components that help to create apps that better utilize the iPad screen size and usage patterns.

Tablet Considerations
Split Views
Modal Modes
New Input Methods
Conditional behavior

Implementing Application Preferences

Creating user-customizable applications means managing, saving and using user settings.

The Settings Application Interface
Settings Bundle
Creating and modifying the Settings Bundle
Configuring a Settings Page

Data Persistence

iOS has a set of tools and frameworks for storing, accessing, and sharing data. Core Data is a data modeling framework, while SQLite is perfect for low-level relational database work. Apps can share data using a URL-based system that works across all of iOS. iOS apps even have access to a device’s global data such as contacts in the Address Book, and photos in the Photo Library.

Core Data Basics
Using SQLite
File Saving Strategies
Property Lists
Archiving Model Objects

Programming the Multitouch interface

Because an iPad or iPhone screen can detect multiple touches at the same time and track them independently, apps are able to detect a wide range of gestures, giving the user power that goes beyond classical user interfaces.

Events and Touches in iOS
The Multitouch architecture
Responder chain enabling cooperative event handling
Taps, touches, gestures
Gesture recognizers for swipes, multiple taps, pinches
Custom Gestures


The iOS has a robust localization architecture that lets you easily translate your application into multiple languages.

Support for Internationalization
Preparing for Localization
Localizing String Resources


This module discusses the various ways to consume web services in an iOS applicatoin.

Low-level networking
The CFNetwork framework
Working with streams
Communicating with http and ftp servers.
Understanding REST
Calling REST services with RestKit
Using UIWebView to embed web content
Apple push notification service

If time permits:

Core Location
Core Motion
Embedding maps with Map Kit
Ticketing with Passbook
Managing reminders with Map Kit
Audio & Video, Animation
iCloud APIs

Creating a service for your class library

During development, I always use a small WPF client to test the program, when test are going ok I create the service.

This week I used this tutorial twice, it only took me 1 hour to set it up correctly and needly (with event logging etc).


Logging I do with the aidf of a simple extra class (code found at the end of this post)

EventLogWriter.Instance.WriteToLog("Service Stopped", EventLogEntryType.Information);

I use this simple singleton class to help with the event logging:


/// <summary>

    /// Class enabling writing to the eventlog

    /// </summary>

    public class EventLogWriter


        private System.Diagnostics.EventLog eventWriter;


        #region Singleton Pattern


        // Singleton.

        private static EventLogWriter _instance;


        /// <summary>

        /// Singleton Pattern.

        /// </summary>

        public static EventLogWriter Instance




                if (EventLogWriter._instance == null)


                    EventLogWriter._instance = new EventLogWriter();



                return EventLogWriter._instance;






        /// <summary>

        /// Constructor

        /// </summary>

        public EventLogWriter()



            // init eventWriter


            eventWriter = new EventLog();

            eventWriter.Log = "Application";

            eventWriter.Source = "SFIAutoMeasurementService";



        /// <summary>

        /// Writes an entry to the eventlog

        /// </summary>

        /// <param name="msg">Message to write</param>

        /// <param name="entryType">Eventlog entry type</param>

        public void WriteToLog(string msg, EventLogEntryType entryType)





                if (System.Diagnostics.EventLog.SourceExists("SFIAutoMeasurementService"))


                    eventWriter.WriteEntry(msg, entryType);



            catch { }




On leave and enter hit events in UITextField (iOS)

If you want to catch the event when a user leaves a text box and has changed something, or when he presses enter in the text box itself, you will need to do 2 things:

- For the leave it's very easy, Apple already prepared this event for you. Use the Editing Did End Action and connect it to your controller's implementation file:


But now you also want to capture the event that occurs when the user presses enter in the textfield.

For this we start by adding the UITextFieldDelegate protocol in the controller.h:

@interface PhotoTakerViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIPopoverControllerDelegate, UITextFieldDelegate >

next we implement it like this:

- (BOOL) textFieldShouldReturn:(UITextField *)textField


    ...Do something

    return YES;