Bronze and Silver solution


Here is my bronze solution.

Just added this code in MapViewController:

-(void) loadView
    MKMapView *map = [[MKMapView alloc] init];
    self.view = map;

Of course you need to import MapKit Framework (and include files) and add MapViewController to the UITabBarController in the appDelegate.

Here is also code for [u]Silver[/u] solution:

[code]#import "HypnosisViewController.h"
@implementation HypnosisViewController

// Override UIViewController's designated initializer
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle
    // Call the superclass's designated initializer
    self = [super initWithNibName:nil
    if (self)
        // Get the tab bar item
        UITabBarItem *tbi = [self tabBarItem];
        // Give it a label
        [tbi setTitle:@"Hypnosis"];
        // Create UIImage from a file
        // This will use on retina display devices
        UIImage *i = [UIImage imageNamed:@"Hypno.png"];
        // Put that image on the tab bar item
        [tbi setImage:i];
    return self;

// Let's create the view of this view controller programatically
-(void) loadView
    CGRect frame = [[UIScreen mainScreen] bounds];
    // Create a Hypnosis view
    // We set this view as the view of this viewcontroller later
    v = [[HypnosisView alloc] initWithFrame:frame];
    // Create UISegmentedControl  
    CGRect segmentRect = CGRectMake(frame.origin.x+frame.size.width/2.0-90,frame.origin.y+frame.size.height-150,180,50);
    UISegmentedControl *chooseColor = [[UISegmentedControl alloc] initWithFrame:segmentRect];
    [chooseColor insertSegmentWithTitle:@"Red" atIndex:0 animated:NO];
    [chooseColor insertSegmentWithTitle:@"Green" atIndex:1 animated:NO];
    [chooseColor insertSegmentWithTitle:@"Blue" atIndex:2 animated:NO];
    chooseColor.selectedSegmentIndex = 0;
    [chooseColor  addTarget:self action:@selector(pickOne:) forControlEvents:UIControlEventValueChanged];
    // Add the segmented control to Hypnosis view as a subview
    [v addSubview:chooseColor];
    // Set Hypnosis view as *the* view of this view controller
    self.view = v;

// If user clicks the segmented control, change color of the circle inside the Hypnosis view
-(void) pickOne:(id)sender
    UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;
   if([segmentedControl selectedSegmentIndex] == 0)
       [v setCircleColor:[UIColor redColor]];
   }else if([segmentedControl selectedSegmentIndex] == 1)
       [v setCircleColor:[UIColor greenColor]];
   }else if([segmentedControl selectedSegmentIndex] == 2)
       [v setCircleColor:[UIColor blueColor]];

// View did load
-(void) viewDidLoad
    // Always call the super implementaiton of viewDidLoad
    [super viewDidLoad];
    NSLog(@"HypnosisViewController loaded its view.");