본문 바로가기

교육/iOS

[iOS] 눈내리는 애니메이션 만들기

    UIImage* img = [UIImage imageNamed:@"bg_message.9.png"];

    UIImageView* imgView = [[UIImageView alloc ]initWithImage:img];

    imgView.center = CGPointMake(rand()%320, 0);

    [self.view addSubview:imgView];

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationDuration:2];

    imgView.center = CGPointMake(rand()%320, 480);

    [UIView commitAnimations];

    //[self finish:imgView];

    //특정함수를2초뒤

    [self performSelector:@selector(finish:) withObject:imgView afterDelay:2];



-(void) finish:(UIImageView*)imgView

{

    [imgView removeFromSuperview];

}

'교육 > iOS' 카테고리의 다른 글

[iOS] init  (0) 2016.08.03
[iOS] xib와 strong, weak  (0) 2016.08.03
[iOS] Xib  (0) 2016.08.01
[iOS] 뷰의 sub뷰 가져오기  (0) 2016.08.01
[iOS] 구조  (0) 2016.08.01