Placement of the asterisk in Objective-C

前端 未结 14 1073
鱼传尺愫
鱼传尺愫 2020-11-27 13:34

I have just begun learning Objective-C, coming from a VB .Net and C# .Net background. I understand pointer usage, but in Objective-C examples I see the asterisk placed in s

14条回答
  •  时光取名叫无心
    2020-11-27 14:16

    in the xcode4 documentation sample code you can see 3. all the time, for example in MoveMeView.m

    #if 1
    
    - (void)growAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    
    #define MOVE_ANIMATION_DURATION_SECONDS 0.15
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:MOVE_ANIMATION_DURATION_SECONDS];
    placardView.transform = CGAffineTransformMakeScale(1.1f, 1.1f); 
    /*
     Move the placardView to under the touch.
     We passed the location wrapped in an NSValue as the context.
     Get the point from the value, then release the value because we retained it in touchesBegan:withEvent:.
     */
    NSValue *touchPointValue = (NSValue *)context;
    placardView.center = [touchPointValue CGPointValue];
    [touchPointValue release];
    [UIView commitAnimations];
    }
    

提交回复
热议问题