Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional iPhone and iPad Application Development
This is the forum to discuss the Wrox book Professional iPhone and iPad Application Development by Gene Backlin; ISBN: 978-0-470-87819-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional iPhone and iPad 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 Display Modes
  #1 (permalink)  
Old April 1st, 2011, 11:00 AM
Friend of Wrox
Points: 1,671, Level: 16
Points: 1,671, Level: 16 Points: 1,671, Level: 16 Points: 1,671, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2010
Posts: 298
Thanks: 1
Thanked 62 Times in 60 Posts
Default Chapter 11

Two minor tweaks that I would suggest are:
1. When the program begins for the first time there is nothing on the pasteboard. The paste menu option should not be available in this situation. So in the -touchesBegan… method

Code:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSSet *copyTouches = [event touchesForView:imageView];
    NSSet *pasteTouches = [event touchesForView:pasteView];
    
    UIPasteboard *appPasteBoard = [UIPasteboard pasteboardWithName:@"CopyPasteImage" create:YES];
NSData *data = [appPasteBoard dataForPasteboardType:
@"yourReverseDNS.CopyPasteImage.imageView"];
/*Sorry for the weird formatting but the site is inserting spaces where they don't belong and this is the only way I can get it to display correctly    
*/
   
    [self becomeFirstResponder];
     
    if ([copyTouches count] > 0) {
        [self performSelector:@selector(showMenu:) withObject:imageView afterDelay:0.9f];
    }else if ([pasteTouches count] > 0 && data != nil)
    {
        [self performSelector:@selector(showMenu:) withObject:pasteView afterDelay:0.9f];
    }
    [super touchesBegan:touches
              withEvent:event];
}
2. The Restore option should only be available if the imageView is hidden, since when it is visible there is nothing to restore. So in the -showMenu… method

Code:
-(void)showMenu:(id)view
{
    self.selectedView = view;
    
    UIMenuController *menu = [UIMenuController sharedMenuController];
    
    if (view == pasteView && imageView.hidden == YES) {
        UIMenuItem *menuItem = [[UIMenuItem alloc]
                                initWithTitle:@"Restore View"
                                action:@selector(restoreView:)];
        menu.arrowDirection = UIMenuControllerArrowLeft;
        menu.menuItems = [NSArray arrayWithObject:menuItem];
    }
    [menu setTargetRect:CGRectMake(5, 10, 1, 1) inView:view];
    [menu setMenuVisible:YES animated:YES];
}
One question. Why have you made the pasteBoard persistent?

One comment. Cleanup is missing on p. 426 and 427 -viewDidUnload and -dealloc.

Bob
Reply With Quote
  #2 (permalink)  
Old April 1st, 2011, 11:08 AM
Wrox Author
Points: 362, Level: 6
Points: 362, Level: 6 Points: 362, Level: 6 Points: 362, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 61
Thanks: 0
Thanked 9 Times in 7 Posts
Default

Quote:
Originally Posted by thepianoguy View Post
One question. Why have you made the pasteBoard persistent?

One comment. Cleanup is missing on p. 426 and 427 -viewDidUnload and -dealloc.

Bob
Good additions Bob.

I made it persistent at the advice of the Technical Editor

Thanks also about the cleanup.

I hope you are enjoying the book !
Reply With Quote
Reply


Thread Tools
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 11 Moorish BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 11 June 4th, 2008 05:57 PM
chapter 11 figure 11-7 relative positioning pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 November 29th, 2007 06:11 AM
Chapter 11: kiley-s BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 10 March 8th, 2007 08:19 PM
Chapter 11 zaidqais Visual Basic 2005 Basics 0 June 2nd, 2006 05:09 AM
Chapter 11 kappa3 Wrox Book Feedback 0 October 8th, 2003 12:21 PM



All times are GMT -4. The time now is 02:13 AM.


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