开发者

UIScrollView - scrollRectToVisible - showing a button at the center of the screen?

开发者 https://www.devze.com 2023-01-12 01:42 出处:网络
I have a uiscrollview with tons of buttons in it. What I need to do is show one of these buttons at the center of the screen.

I have a uiscrollview with tons of buttons in it. What I need to do is show one of these buttons at the center of the screen.

When I use scrollRectToVisible (passing the button-frame), the scrollview indeed shows the button - but sometimes at the top-left corner, sometimes at the bottom right c开发者_如何学Pythonorner - apparently depending on when the button hits the visible area of the scrollview.

But - as mentionend - I need the button to appear in the center of the screen.

Any hints on how to achieve that?

Thanks for any help!


You could pass a rect with the size of your scroll view's visible area, centered around the button's center.

0

精彩评论

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