Design with iPhone Project 9: Camera interface

Warning:
Content of this website may change at any time up until class meeting.

Project Topics


Preparation


Create a new iOS app in Xcode

p1fig-IosView.jpg
Fig. 1
p1fig-projWin1.jpg
Fig. 2 Xcode Workspace Window



Camera Interface
p9fig-cameraPic1.jpg
Fig. 3
//  proj9ViewController.h
#import <UIKit/UIKit.h>
@interface proj9ViewController : UIViewController <UIImagePickerControllerDelegate,UINavigationControllerDelegate>

@property (retain, nonatomic) IBOutlet UISwitch *mySwitchVal;
- (IBAction)mySwitchChanged:(id)sender;
@end
- (IBAction)mySwitchChanged:(id)sender {
    UIImagePickerController *imgPicker;
    imgPicker = [[UIImagePickerController alloc] init]; 
    if ([mySwitchVal isOn]) {
        imgPicker.sourceType=UIImagePickerControllerSourceTypeCamera;
    imgPicker.delegate=self;
    imgPicker.allowsEditing = NO;
    [self presentModalViewController:imgPicker animated:YES];
     [imgPicker release];
    }
}


p9fig-cameraPic2.jpg
Fig. 4





Demonstration



Report



Copyright 2011 by T.P. Weldon


Apple, iPhone, iPad, and Xcode  are registered trademarks of Apple Inc.