How to solve the problem of invalid UIView effect in iOS7

Source: Internet
Author: User

How to solve the problem of invalid UIView effect in iOS7

Recently I want to make a running horse lamp effect, so I wrote the following code for the running horse lamp effect... However, debugging found that the animation in iOS6 can be executed, but the animation in iOS7 is not executed, and the expected effect is not achieved.

[_scrollLabel sizeToFit];    CGRect frame = _scrollLabel.frame;    frame.origin.x = 320;    _scrollLabel.frame = frame;    [UIView setAnimationsEnabled:YES];    [UIView beginAnimations:@"testAnimation" context:NULL];    [UIView setAnimationDuration:10.f];    [UIView setAnimationCurve:UIViewAnimationCurveLinear];    [UIView setAnimationDelegate:self];    [UIView setAnimationRepeatAutoreverses:NO];    [UIView setAnimationRepeatCount:999999];    frame = _scrollLabel.frame;    frame.origin.x = -frame.size.width;    NSLog(@"frame orgin:%f",frame.origin.x);    _scrollLabel.frame = frame;    [UIView commitAnimations];
Then I checked all kinds of information on the Internet and did not solve it... In the end, I found that this view controller is a present mode view, and the UIView that is modal under iOS7 has a problem... Replace present with push... However, push does not achieve the prensent effect, so it imitates the present and implements the present animation in the push view. The Code is as follows:

1. push

MCLotteryListViewController *list = [[MCLotteryListViewController alloc]init];    //list.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;//    [self presentViewController:list animated:YES completion:^{//        //    }];    [UIView  beginAnimations:nil context:NULL];    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];    [UIView setAnimationDuration:0.75];    [self.navigationController pushViewController:list animated:NO];    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO];    [UIView commitAnimations];
Ii. pop

[UIView  beginAnimations:nil context:NULL];    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];    [UIView setAnimationDuration:0.75];    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];    [UIView commitAnimations];        [UIView beginAnimations:nil context:NULL];    [UIView setAnimationDelay:0.375];    [self.navigationController popViewControllerAnimated:NO];    [UIView commitAnimations];
Reprinted, please note, correct the error!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.