Offsetting UIRefreshControl

前端 未结 9 1491
醉话见心
醉话见心 2020-12-14 01:14

I am currently using a JASidePanel for my application and I have a UITableViewcontroller with a UIRefreshControl as one of the ViewControllers for it. The width of my tablev

9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-14 02:00

    UIRefreshControl's frame is automatically managed so trying to change it's position will likely yield in unexpected results (especially between iOS SDK versions). As you've noted, the control is always centered horizontally in it's superview's frame. Knowing this you can 'take advantage' of the situation by offsetting your superview.

    In your case, set your table view's frame to CGRect(-40, 0, 360, superViewHight). This will cause your table view to sit 40 points to the left of the window. So you will need to adjust your table view's content accordingly so that it sits 40 points to the right or just extends an extra 40 points, but the stuff rendering off screen should be padding.

    Once you do this your UIRefreshControl will sit 20 points to the left as you desire due to the fact that it is centered.

    enter image description here

提交回复
热议问题