The solution to the problem of UIView effect failure in iOS7

Source: Internet
Author: User

Recently want to do a marquee effect, so write out the following code for the effect of the marquee ... However, the debug found that the animation can be performed under IOS6, but the animation is not performed under IOS7, and does not achieve the desired effect.

[_scrolllabel SizeToFit];    CGRect frame = _scrolllabel.frame;    Frame.origin.x =;    _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];
And then on the internet to look up all kinds of information, have not solved ... Finally found that my view controller is a present modal view, in IOS7 under the modal view UIView there is a problem ... Decisively changed the present to push ... However, push does not reach the prensent effect, so it mimics present and implements present animations in the push view. The code is as follows:

First, 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];
Second, 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];
Reprint please indicate, error please correct me!

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.