简体   繁体   中英

How to change page width on UIScrollView?

When my uiscrollview with paging enabled gets rotated, it works fine, but it still thinks the images are the same width, so the pages don't take up the full page. so can i tell it the "pages" are now as wide as the height?

You can enable autoresizing subviews for the UIScrollView , like for any other view. Of course, you need to set appropriate autoresizing masks for each of your subviews. This will take care of resizing, repositioning, etc. However, the contentSize property isn't automatically adjusted, so you need to take care of that yourself, for example in layoutSubviews . I've done all of this before, it's a little fiddly, but doable as a subclass of the scroll view. I've actually publicly released this autoresizing scroll view, but it's commercially licensed, and I'm not sure what SO policy is on that kind of thing, so I won't link to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM