Design with iPhone Project 4: Text, images, sliders, switches, web, scrolling

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

p4fig-textView1.jpg
Fig. 3

p4fig-outlet1.jpg
Fig. 4
p4fig-outlet1synth.jpg
Fig. 5
p4fig-placeHolder.jpg
Fig. 6
p4fig-appSim1.jpg
Fig. 7
At boundaries, the feature vector may make a transition through a region of feature space that is incorrectly assigned to a third class. To remove such errors, a morphological operator is proposed. The overall effect of the proposed operator resembles a morphological erosion followed by a dilation.

Working with the keyboard
p4fig-keyboard.jpg
Fig. 8
p4fig-resignKbd.jpg

- (IBAction)resignTextFieldKeyboard:(id)sender {
    [myTextField resignFirstResponder]; 
}

- (IBAction)resignTextFieldKeyboard:(id)sender {
    [myTextField resignFirstResponder];
    myTextView.text=myTextField.text; 
}

p4fig-appSim2.jpg

Fig. 9



Viewing Images in iOS
p4fig-addFiles.jpg
Fig. 10
p4fig-imageBlank.jpg
Fig. 11

- (IBAction)resignTextFieldKeyboard:(id)sender {
    [myTextField resignFirstResponder];
    myTextView.text=myTextField.text;
     UIImage *image = [UIImage imageNamed: myTextField.text];
    [myImageView setImage:image];
}

p4fig-imageClt.jpg
Fig. 12


Sliders and Switches
p4fig-sliderSwitch.jpg
Fig. 13
p4fig-sliderAction.jpg             p4fig-switchAction.jpg
Fig. 14

- (IBAction)mySliderAction:(id)sender {
    mySliderLabel.text=
    [[NSString alloc] initWithFormat:@"slide=%1.2f",
      mySlider.value];
}

- (IBAction)mySwitchAction:(id)sender {
    mySwitchLabel.text=
    [[NSString alloc] initWithFormat:@"switch=%d",
     (int)(mySwitch.on)];
}

p4fig-appSim3.jpg
Fig. 15


Web Views
p4fig-webView.jpg
Fig. 16
p4fig-segValueChanged.jpg
Fig. 17


- (IBAction)mySegCtrlValueChanged:(id)sender {
    NSURL * courseURL;
    NSURL * unccURL;
    courseURL=[[NSURL alloc] initWithString:@"http://coe.uncc.edu/~tpweldon/courses/" ];
    unccURL=[[NSURL alloc] initWithString:@"http://www.uncc.edu/" ];
    int kk=0;
    kk=(int) (mySegmentControl.selectedSegmentIndex);
    switch (kk)
    {
        case 0:
            [myWebView loadRequest:[NSURLRequest requestWithURL:courseURL]];
            break;
        case 1:
            [myWebView loadRequest:[NSURLRequest requestWithURL:unccURL]];
            break;
    }
    [courseURL release];
    [unccURL release]; 
}

p4fig-appSim4.jpg
Fig. 17

p4fig-appSim5.jpg
Fig. 18

Scroll App Views and Screen Sizes
p4fig-scrollView.jpg
Fig. 19
- (void)viewDidLoad
{
    myScrollView.contentSize=CGSizeMake(400.0,600.0);
    [super viewDidLoad];
}
    UIScreen *scrn = [UIScreen mainScreen] ; 
    myLabel.text=[[NSString alloc]
                  initWithFormat:
                  @"Screen %1.2f x %1.2f pixels",
                  scrn.bounds.size.width*scrn.scale,
                  scrn.bounds.size.height*scrn.scale];
p4fig-appSim6.jpg
Fig. 20
p4fig-appSim7.jpg
Fig. 21



Demonstration



Report



Copyright 2011 by T.P. Weldon


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