码迷,mamicode.com
首页 > 其他好文 > 详细

两个按钮(背景图不同)的翻转

时间:2014-07-18 18:34:16      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:width   io   for   re   c   ar   

UIButton *downButtonOne = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 50)];

        [downButtonOne setImage:[UIImage imageNamed:@"main_advertisement1.png"] forState:UIControlStateNormal];

        [self addSubview:downButtonOne];

        

        UIButton *downButtonTwo = [UIButton buttonWithType:UIButtonTypeCustom];

        downButtonTwo.frame = CGRectMake(0, 0, self.bounds.size.width, 50);

        [downButtonTwo setImage:[UIImage imageNamed:@"main_advertisement.png"] forState:UIControlStateNormal];

        [self addSubview:downButtonTwo];

        [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(adAnimation) userInfo:nil repeats:YES];

- (void)adAnimation

{

    [UIView animateWithDuration:1.0 animations:^{

        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self cache:YES];

        [self exchangeSubviewAtIndex:0 withSubviewAtIndex:1];

    }];

}

两个按钮(背景图不同)的翻转,布布扣,bubuko.com

两个按钮(背景图不同)的翻转

标签:width   io   for   re   c   ar   

原文地址:http://www.cnblogs.com/qianyindichang/p/3853432.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!