开发者

how can i modify contentInset as my animation is going?

I would like to modify my contentInset to the origin of a label that is animating as it is animating ( i'm lowering a label and i would like to scroll the view to the label's origin as it is animating so that it looks like it is stayi开发者_StackOverflow中文版ng still )


You can add both animations in one block like this:

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:<#duration#>];

    [<#yourLabel#> setFrame:CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>)];
    [<#yourScrollView#> setContentInset:UIEdgeInsetsMake(<#CGFloat top#>, <#CGFloat left#>, <#CGFloat bottom#>, <#CGFloat right#>)];

    [UIView commitAnimations];

Let me know if this works for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜