开发者

Adding views on top of UIScrollView

开发者 https://www.devze.com 2023-03-14 00:30 出处:网络
When you add a subView to UIScrollView, should this change the smoothness, or anything else for the UIScrollView?For example, if you have a UIScrollView with mainly text, then add a couple of views on

When you add a subView to UIScrollView, should this change the smoothness, or anything else for the UIScrollView? For example, if you have a UIScrollView with mainly text, then add a couple of views on top of it in order to add an effect t开发者_如何学Pythono the text, should this change any of the gestures, or smoothness of the original UIScrollView without the subViews? Thanks.


It won't change the gestures.

As for the smoothness, it depends on how heavy your subviews are. I guess that if you add a lot of them, and they require to render a lot of dynamic content and such, it could make the scrolling a little rough, but if you are adding only a few subviews you should be fine.

As a comparison, think that a UITableView is a UIScrollView with a LOT of subviews on it (each cell is a subview, and cells have several subviews too), and it usually renders fast.


If the sub views you implement have the worst drawRect: implementation in the world, you don't need very many views to get slow, un-smooth scrolling.

You should profile your code in Instruments with the Time Profiler, and see what causes the slow scrolling.

0

精彩评论

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