Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning iOS 5 Application Development
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning iOS 5 Application Development
This is the forum to discuss the Wrox book Beginning iOS 5 Application Development by Wei-Meng Lee; ISBN: 978-1-1181-4425-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning iOS 5 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 11th, 2012, 11:31 AM
Authorized User
Points: 172, Level: 3
Points: 172, Level: 3 Points: 172, Level: 3 Points: 172, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2010
Posts: 21
Thanks: 0
Thanked 6 Times in 4 Posts
Default Errata for Chapter 7, project ScreenRotations

In Chapter 7, in the project ScreenRotations, the positionViews: method should have an additional parameter and the first line commented out:
Code:
-(void) positionViews:(UIInterfaceOrientation) destOrientation {    
    // UIInterfaceOrientation destOrientation = self.interfaceOrientation; 
    if (destOrientation == UIInterfaceOrientationPortrait ||
        destOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        //—-if rotating to portrait mode—-
        btn.frame = CGRectMake(20, 20, 233, 37);
    } else {        
        //—-if rotating to landscape mode—-
        btn.frame = CGRectMake(227, 243, 233, 37);
    }       
}
So, when calling the positionViews: method, you should call it with the destination orientation:

Code:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
                               duration:(NSTimeInterval)duration {
    [self positionViews:toInterfaceOrientation];
}
Finally, in the viewDidLoad method, call the positionViews: method with the current destination:

Code:
- (void)viewDidLoad
{
    [self positionViews:[[UIApplication sharedApplication] statusBarOrientation]];
    [super viewDidLoad];
}
The original code in the book works when using the positionView method with the willAnimateSecondHalfOfRotationFromInterfaceOrient ation: method. However, since the latter method is deprecated, you need to manually pass in the destination orientation to the positionViews method.
Reply With Quote
The Following 2 Users Say Thank You to weimenglee For This Useful Post:
Brabbeldas (February 17th, 2012)
  #2 (permalink)  
Old May 14th, 2012, 08:51 PM
Authorized User
Points: 38, Level: 1
Points: 38, Level: 1 Points: 38, Level: 1 Points: 38, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 3
Thanked 0 Times in 0 Posts
Default The original code in the book also works if you...

...use the willAnimateRotationToInterfaceOrientation: method (instead of, as pointed out here, the willAnimateSecondHalfOfRotationFromInterfaceOrient ation: method).
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 ScreenRotations Errata FrankNatoli BOOK: Beginning iOS 4 Application Development 0 June 20th, 2011 09:30 PM
Possible Errata in Chapter 13? PMooney90 BOOK: Beginning ASP.NET 4 : in C# and VB 1 January 11th, 2011 01:50 PM
Chapter 4 errata notig BOOK: Beginning Visual C# 2010 1 September 23rd, 2010 10:27 AM
Chapter 22: Introduction to Project Management... Project Program integration chrisa BOOK: Professional Application Lifecycle Management with Visual Studio 2010 1 September 15th, 2010 03:28 PM
Chapter 5 Errata rogerj BOOK: Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0 0 February 21st, 2009 04:53 PM



All times are GMT -4. The time now is 07:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.