Error (Expected':'before '~' token)

Discussion in 'iOS Programming' started by rustywild, Mar 12, 2011.

  1. rustywild, Mar 12, 2011
    Last edited by a moderator: Mar 12, 2011

    rustywild macrumors newbie

    Joined:
    Mar 9, 2011
    #1
    I Have it:
    Code:
    -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    } 
    -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    	CGPoint newTouch = [[touches anyObject]locationInView:[self~CCC superview]]; // Error Expected':'before '~' token
    
     
    	CGPoint lastTouch = [[touches anyObject]previousLocationInView:[self~CCC superview]];
    	
    	float xDif = newTouch.x - lastTouch.x;
    	float yDif = newTouch.y - lastTouch.y;
    	
    	CGAffineTransform translate = CGAffineTransformMakeTranslation(xDif,~CCC yDif); 
    	[self setTransform: CGAffineTransformConcat([self transform],~CCC translate)];
    																	
    
    } 
    -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    } 
    -(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
    	[self touchesEnded:touches withEvent:event]; 
    }
    
    @end
    
    How i can repair?

    thanx
     
  2. dantastic macrumors 6502

    dantastic

    Joined:
    Jan 21, 2011
    #2
    What is 'self~CCC' ?

    I'm not sure you can use the character '~' in a variable name. this should probably be 'self.CCC'?
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    ~ is certainly not valid in a variable name: it's a C special character and no special character may appear in a variable name.
     
  4. rustywild thread starter macrumors newbie

    Joined:
    Mar 9, 2011
    #4
    If change '~', for '.' it's worse. Give me 5 erros
     
  5. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    What was the ~ for. Why did you type it? Until we know that we can't really advise.
     
  6. rustywild thread starter macrumors newbie

    Joined:
    Mar 9, 2011
    #6
    I copied the code from a book, I use it to move a photo with multitouch
     
  7. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #7
    And this is the problem with copying stuff. Don't copy anything that you don't understand. And that means every character, line and statement.
     
  8. balamw, Mar 12, 2011
    Last edited: Mar 12, 2011

    balamw Moderator

    balamw

    Staff Member

    Joined:
    Aug 16, 2005
    Location:
    New England
    #8
    Which book?

    EDIT: Nevermind I see it. It seems to be a typesetting flaw in the eBook version of Rory Lewis' "IPHONE AND IPAD APPS FOR ABSOLUTE BEGINNERS" (who knows. maybe the hardcopy has the same issue). The screenshot of the code doesn't have ~CCC while the code block itself does. In other examples, code blocks include a stylized arrow to visually represent a carriage return, these ~CCCs seem to have been failed arrows.

    The source code is available here: http://apress.com/book/downloadfile/4588

    B
     
  9. rustywild thread starter macrumors newbie

    Joined:
    Mar 9, 2011
    #9
    thanx a lot. just erase ~CCC, and the app work fine
     
  10. rustywild thread starter macrumors newbie

    Joined:
    Mar 9, 2011
    #10
    thanx for your advice
     

Share This Page