通过设置图片实现app启动广告页的效果

来源:互联网 发布:软件功能需求说明书 编辑:程序博客网 时间:2024/04/29 05:14

 

//通过设置一个图片实现广告页得效果;

    UIImageView *niceView = [[UIImageViewalloc]initWithFrame:CGRectMake(0,0,PMWIDTH,PMHEIGHT)];

    niceView.userInteractionEnabled =YES;

    niceView.image = [UIImageimageNamed:@"yindao1"];

    self.btn = [UIButtonbuttonWithType:UIButtonTypeSystem];

    self.btn.frame =CGRectMake(300,30,40, 20);

    self.btn.backgroundColor = [UIColorredColor];

    [niceView addSubview:self.btn];

    //添加到场景

    [self.windowaddSubview:niceView];

    //放到最顶层;

    [self.windowbringSubviewToFront:niceView];

    [self.btnaddTarget:selfaction:@selector(loginSuccess)forControlEvents:UIControlEventTouchUpInside];

    

    //开始设置动画;

    [UIViewanimateWithDuration:4.0animations:^{

        [UIViewsetAnimationTransition:UIViewAnimationTransitionNoneforView:self.windowcache:YES];

        

        niceView.frame =CGRectMake(-30, -30,PMWIDTH+60,PMHEIGHT+60);

        

    } completion:^(BOOL finished) {

        [UIViewanimateWithDuration:4.0animations:^{

            

            niceView.alpha =0.0;

        }];

        

    }];


    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20.0 * NSEC_PER_SEC)),dispatch_get_main_queue(), ^{

        

        niceView.alpha =0.0;

        

    });

1 0
原创粉丝点击