Design with iPhone Project 9: Camera interface
Warning:
Content of this website may change at any time up until class meeting.
Project Topics
Preparation
- Download and open the project template below, so that you can cut and paste answers into the report as you complete the project.
- Create a new directory "Project9" for this project in your Documents directory, if you have not already done so.
Create a new iOS app in Xcode
- Run Xcode from the /Developer/Applications directory, and click "Create new Xcode project"
- Create an iOS "view-based application" as shown below (see green and red arrows below):
Fig. 1
- In the next pop-up, enter ProductName "project9xyz" where xyz is
your initials. Add company identifier "edu.uncc" (shown in the
red circle below) and device family "iPhone"
- In the next pop-up, select your project directory for your project
- Your new project should appear in the Xcode workspace window as below:
Fig. 2 Xcode Workspace Window
Camera Interface
- Build the camera interface below
- Set the default switch position to off in the nib file
Fig. 3
- Take a snapshot of your window as in Fig. 3 above (Make sure to include the NavigationBar with your initials, and the on/off switch), and paste it into your report as Fig. P1. (
Use the application Grab.app in the Applications/Utilities folder)
- As outlined on p. 492, implement access to the camera by:
- Modify
the viewcontroller to include the UIImagePickerControllerDelegate and
the UINavigationControllerDelegate protocols as illustrated below:
// proj9ViewController.h
#import <UIKit/UIKit.h>
@interface proj9ViewController : UIViewController <UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property (retain, nonatomic) IBOutlet UISwitch *mySwitchVal;
- (IBAction)mySwitchChanged:(id)sender;
@end
- Add an action to the switch, so that when the switch is turned on then the camera is viewed:
- (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];
}
}
- Run the app
- When the switch is turned on, you should see a camera interface as follows:
Fig. 4
- Take a snapshot of your window as in Fig. 4 above (Make sure to include your example image, and the retake and use buttons), and paste it into your report as Fig. P2. (
Use the ipod snapshot capability and upload the image )
Demonstration
- Demonstrate the complete project (all apps) on your iPod and have the instructor sign the cover sheet of your report. (Worth 20% of project) (Q)
Report
- Include the plot/picture/snapshot numbers P1, P2, etc. in captions, along with a short description!
- Place answers to all questions on one or more consecutive sheets of paper at the front of the report!
- Include the question numbers Q1, Q2, etc in answers, along with the question!
- Do NOT scatter the question answers throughout the report, keep them together
- Write a cover sheet + 1 page executive summary ONLY!!! Describe any unresolved issues.
- Make sure that you include question numbers and plot numbers on all sheets!
- Instructor will only look on the question answer-sheets for any discussion.
- All extraneous material WILL BE IGNORED!
- Do not write any discussion, except directly on the question answer-sheets or 1 page summary.
- Do not add extraneous pages.
- Do not put explanations on plots unless specifically directed to do so.
- Include any problems or unresolved issues in the summary.
- ONLY turn in the specific snippets of source code as requested (NOT ANYTHING ELSE!!")
- Include any problems or unresolved issues in the summary.
Copyright 2011 by T.P. Weldon
Apple, iPhone, iPad, and Xcode are registered trademarks of Apple Inc.