开发者

how can i modify contentInset as my animation is going?

开发者 https://www.devze.com 2023-03-22 09:08 出处:网络
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 animati

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

精彩评论

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