0

に取り組んでいUIViewます。このビューは、ボタンのクリックで展開および縮小されます。iOS<=5では動作しますが、 iOS6では動作しません。私のコードを修正するか、説明してください。

ありがとう。

私のコード:

    CGFloat x= 60,y = 391,w1=210,h1=48;
    [ViewShare setHidden:YES];
    [UIView beginAnimations:@"animationOff" context:NULL]; 
    [UIView setAnimationDuration:0.2f];
    [ViewShare setFrame:CGRectMake(x, y, w1, h1)];
    [UIView commitAnimations];

そして参照ページ

ありがとう..

4

1 に答える 1

1

Mani, you should use the block based animation instead, because the use of commit animation is discouraged after iOS 4.0.

There is lot of GUI bug code if you try to cross lot of IOS, and try to use "deprecated" method. By the way your code is correct.

If you don't use IOS before 4.0, use instead

animateWithDuration:animations:completion:

Here's an example:

[UIView animateWithDuration: 0.2f
     animations:^{
    [ViewShare setFrame:CGRectMake(60, 391, 210, 48)];
}
     completion:^(BOOL finished){ 
    // what you want when the animation is done
}];

Note that sometime, you need to switch behavior depending on iOS version, it is very always GUI related. That make me very nervous. :)

于 2013-03-05T08:49:12.883 に答える