DOC PREVIEW
SDSU CS 696 - Multi-View Apps

This preview shows page 1-2-3-4-5-32-33-34-35-65-66-67-68-69 out of 69 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 69 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 696 Mobile Application DevelopmentFall Semester, 2010Doc 9 Multi-View AppsSep 28, 2010Copyright ©, All rights reserved. 2010 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA. OpenContent (http://www.opencontent.org/openpub/) license defines the copyright on this document.2Assignment 23NOClearing a field 4Clearing a field = UITextFieldViewModeWhileEditing;5sampleField.rightViewMode = UITextFieldViewModeWhileEditing;TextField Delegate6- (void)viewDidLoad { [super viewDidLoad]; sampleField.delegate = self;}In controllerTextField Delegate Methods7- (void)textFieldDidEndEditing: (UITextField *) textField - (void)textFieldDidBeginEditing: (UITextField *) textField - (BOOL) textFieldShouldBeginEditing: (UITextField *) textField - (BOOL) textFieldShouldClear: (UITextField *) textField - (BOOL)textFieldShouldEndEditing: (UITextField *) textField - (BOOL)textFieldShouldReturn: (UITextField *) textField - (BOOL)textField:(UITextField *) textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)stringtextFieldShouldClear:8Called when user clicks on the clear icontextField: shouldChangeCharactersInRange:replacementString:9Called when user changes text in fieldReturn NOChange not allowedReturn YESChange allowed10iPhone BarsNavigation, Tool, Tab, StatusStatus Bar1120pxgray (default)opaque blacktranslucent blackNavigation Bars12Navigation among different viewsProvide controls that manage items in a viewDrill down hierarchy of viewsNavigation Bars - Navigation13Drilling downNotice the navigation bar has the title of each viewNavigation bar - different sizes14Navigation Bar Color15Blue (default)BlackAny colortranslucentopaqueToolbars16Contains buttons related to object in current viewBlue (default)BlackAny colortranslucentopaqueTab Bars17black backgroundTabs equally sizedDifferent perspectives on same dataDifferent subtasksAllows user to select between different mode of operationAdditional Tabs18Only shows 5 tabsiPod app has 11 tabs19iPadNew WidgetsBars20iPad - Split Screenfull screen view with two side-by-side panesiPad - Popover21transient view displayed when people tab on control or screeniPad - Status Bar22Unless game or full-screen mediaavoid hiding status bariPad - Navigation Bars23Not as common on iPadCan be used inspilt viewpopoverfull-screen viewiPad - Tab Bar24Good for top app viewAvoid too many tabs7 works wellAvoid "More tab"Same tabs in each orientationiPad - Toolbar25Usually on top of screenCan contain segmented controlEach item 44 X 44 pixels or largeriPad - Popover & Bars26iPad - Split view & Bars2728Code levelMultiple ViewsTwo Views, One Controller29Basic Idea30UIViewController property viewContains the view to be displayedChange the viewViewControllerModelViewOutlets & Actions31@interface TwoViewOneControllerViewController : UIViewController {}@property (nonatomic, retain) IBOutlet UIView * mainView;@property (nonatomic, retain) IBOutlet UIView * secondView;- (IBAction) next;- (IBAction) previous;@endAdding a View32Connecting Views33Actions34ActionsnextpreviousSwapping Views35- (IBAction) next { self.view = self.secondView;}- (IBAction) previous { self.view = self.mainView;}Warnings36There are details left out (memory management)There are more structured ways of doing thisDoes not scale wellScreen Rotation37Issues38Allowing the view to rotate with deviceHandling the rotationSprings & Struts in interface builderChange positions in codeUse two views for landscape & portraitAllowing view to rotate39UIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDownUIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait);}In controller classPossible orientationStructs & Springs40Changing location in Code41-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration { if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { label.frame = CGRectMake(50, 30, 58, 21); //CGRectMake(x, y, width, height) text.frame = CGRectMake(193, 35, 213, 31); slider.frame = CGRectMake(160, 298, 283, 23); } else { label.frame = CGRectMake(50, 33, 58, 21); text.frame = CGRectMake(229, 35, 289, 31); slider.frame = CGRectMake(229, 350, 289, 23); }}In controllerUsing 2 views42Double outlets43#import <UIKit/UIKit.h>@interface RotationViewController : UIViewController {}@property (nonatomic, retain) IBOutlet UIView * portrait;@property (nonatomic, retain) IBOutlet UIView * landscape;@property (nonatomic, retain) IBOutlet UILabel * portraitLabel;@property (nonatomic, retain) IBOutlet UITextField * portraitText;@property (nonatomic, retain) IBOutlet UISlider * portraitSlider;@property (nonatomic, retain) IBOutlet UILabel * landscapeLabel;@property (nonatomic, retain) IBOutlet UITextField * landscapeText;@property (nonatomic, retain) IBOutlet UISlider * landscapeSlider;@endSome Outlets44IBOutletsviewportraitlandscapeSwitching Views45-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration { if (interfaceOrientation == UIInterfaceOrientationPortrait) { self.view = self.portrait; self.view.transform = CGAffineTransformIdentity; self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0)); self.view.bounds = CGRectMake(0.0, 0.0, 300.0, 480.0); } else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) { self.view = self.landscape; self.view.transform = CGAffineTransformIdentity; self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(-90)); self.view.bounds = CGRectMake(0.0, 0.0, 460.0, 320.0); }}#define degreesToRadians(x) (M_PI * (x) / 180.0)CGAffineTransformIdentity46 CGAffineTransformTranslate CGAffineTransformScale CGAffineTransformRotate CGAffineTransformInvert CGAffineTransformConcatpreserves parallel lines does not necessarily preserve lengths or angles47Toolbar48Tool bar with two views3 Views, 3 controllers, 3 xib files493 Views, 3 controllers, 3 xib files50SwitchViewControllerviewBlueViewControllerviewYellowViewControllerview3 Views, 3 controllers, 3 xib files51tool


View Full Document

SDSU CS 696 - Multi-View Apps

Download Multi-View Apps
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Multi-View Apps and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Multi-View Apps 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?