UIScrollView page width does not match screen size

260 views Asked by At

I'm trying to find an answer to a bizzare behavoiur ( I probably don't understad it ; / ) of UIScrollView on iOS 7.1) This is the view hierarchy that i have:

  • UIScrollView (width 1024 px)
    • pageHolder (UIView width 2048 px)
      • page1 (UIView)
      • page2 (UIView)

I add first page with frame (0,0, 1024, height) and second page with frame (1024, 0, 1024, height) but this produces a huge gap (size of one page) between page 1 and 2 and i have no clue why..

if I set the origin.x of second page to 512 then i works fine but makes no sense to me ; / width of screen is 1024 so why would this work with 512 ? ( page1 frame (0,0,1024, height) ( page2 frame (512, 0, 1024, height)

any ideas ?

as far as code goes, this is really basic: scrollView.contentSize = (2048, height) pageHolder.size = (2048, height) then simply adding subviews (pages) to pageHolder ...

0

There are 0 answers