Skip to Content
Beginning iOS 5 Application Development
book

Beginning iOS 5 Application Development

by Wei-Meng Lee
January 2012
Beginner content levelBeginner
655 pages
16h 35m
English
Wrox
Content preview from Beginning iOS 5 Application Development

CHAPTER 6 EXERCISE SOLUTIONS

Answer to Question 1

First, handle the Did End on Exit event (or implement the textFieldShouldReturn: method in the View Controller). Then call the resignFirstResponder method of the UITextField outlet to release its first-responder status.

Answer to Question 2

Register for the notifications UIKeyboardDidShowNotification and UIKeyboardDidHideNotification.

Answer to Question 3

NSDictionary* info = [notification userInfo];

//---obtain the size of the keyboard---
NSValue *aValue = [info objectForKey:UIKeyboardFrameEndUserInfoKey];
CGRect keyboardRect =
    [self.view convertRect:[aValue CGRectValue] fromView:nil];

NSLog(@“%f”, keyboardRect.size.height);

Answer to Question 4

Use the UIScrollView to contain views so that the user can scroll through them. Then, set the new size of the scroll view:

- (void)viewDidLoad {
    //---set this to the screen size---
    scrollView.frame = CGRectMake(0, 0, 320, 460);

    //---set this to the final size of the scroll view---
    [scrollView setContentSize:CGSizeMake(320, 713)];

    [super viewDidLoad];
}
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering iOS 12 Programming - Third Edition

Mastering iOS 12 Programming - Third Edition

Donny Wals
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9781118144251Purchase book