开发者

UIScrollView and CALayers

开发者 https://www.devze.com 2022-12-20 14:19 出处:网络
I ha开发者_StackOverflow中文版ve a custom UIView that is composed entirely of CALayers. In the awakeFromNib method it creates and sets all the CALayers into their appropriate positions (CAGradientLay

I ha开发者_StackOverflow中文版ve a custom UIView that is composed entirely of CALayers.

In the awakeFromNib method it creates and sets all the CALayers into their appropriate positions (CAGradientLayer, several CATextLayers, and a few custom CALayer subclasses). The custom UIView does not override the drawRect: method because there's no drawing done directly into the view (all of the drawing is done in the sublayers).

So I took this view and embedded it in a UIScrollView. The problem? No scroll bars appear and the view does not scroll. The view is clearly larger than the bounds of the scroll view, and instead of allowing me to scroll, it just cuts off at the scroll view bounds.

What could be wrong here?


You have to set the scrollView's contentSize.

0

精彩评论

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

关注公众号