This document describes how custom controls can be designed and coded for iOS. A universal design can be adapted for iPhone and iPad using appropriate auto sizing parameters for the UI Controls.

1. UI controls

The UI should be defined in story boards and views.

1.1 Universal Design

An universal app can be built for both iPhone and iPad by keeping the code variation using IF statements and by having separate Views and storyboards for iPhone and iPads. Mark the launch controller as Initial View Controllers.

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.viewControllersArray = [[NSMutableArray alloc] initWithObjects:[NSNull null], [NSNull null], [NSNull null],[NSNull null],nil];
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
        //self.splitViewController.delegate = self;
        [self loadDetailView:0];
    }
}

To use the same table view for both iPad and iPhone but just increase the row height for iPad

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
        self.tableView.rowHeight = 88.0;
    }

1.2 Controller

To load a controller from a storyboard, do the following

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Other_iphone" bundle:nil ];
    UIViewController *rootController = [storyboard instantiateViewControllerWithIdentifier:@"MasterViewController"];
    [self pushViewController:rootController animated:YES];

To show a particular controller in a navigation controller, use the pop to method

    [navController popToViewController:nextController animated:YES];

To dismiss the popover dialog

     [popOverController dismissPopoverAnimated:YES];

1.3. Custom Keypad

A Custom Number Keypad can be built using two UISegmentedControl
Custom Number Keypad
Make sure to suspend the iOS soft keypad by using the following code

    //suspend the keyboard
    [sender resignFirstResponder];

1.4. User Setting

A user setting can be set using the folowing code

    [[NSUserDefaults standardUserDefaults] setInteger:level forKey:@"level"];

1.5 Popup Message

To show a popup momentarily and hide, use the folioing code

    self.ansImageView.image = (retVal ? self.rightImage : self.wrongImage);
    [UIView animateWithDuration:1
                     animations:^{
                         self.ansImageView.alpha = 1;
                     } completion:^(BOOL finished){
                         self.ansImageView.alpha = 0;
                     }];