Getting the visible rect of an UIScrollView's content

前端 未结 8 506
故里飘歌
故里飘歌 2020-11-30 19:17

How can I go about finding out the rect (CGRect) of the content of a displayed view that is actually visible on screen.

myScrollView.bounds

8条回答
  •  悲&欢浪女
    2020-11-30 19:48

    Or you could simply do

    CGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:zoomedSubview];
    

    Swift

    let visibleRect = scrollView.convert(scrollView.bounds, to: zoomedSubview)
    

提交回复
热议问题