evadne / RAPageViewController

Sliding pages side by side, infinitely. Fancy parts from the redacted bits, re-implemented for expressiveness at expense of some naïvety
77 stars 5 forks source link

Ability to decide the `targetContentOffsetCenter` #9

Open stuffmc opened 11 years ago

stuffmc commented 11 years ago

In locateClosestPageOnPrevious:onCurrent:onNext: there's this code

    contentOffset.x + 0.5f * CGRectGetWidth(self.scrollView.frame),
    contentOffset.y + 0.5f * CGRectGetHeight(self.scrollView.frame),

which will call layoutSubview if it you're doing anything "expensive" on the MainThread it will then block while swiping. Although I agree we shouldn't have anything expensive, in the real world, for various reasons, you might have something taking .2 seconds on a device in viewDidLoad.

I figures out having 1.0f instead of 0.5f would then have this "blocking" happening only when reaching the edge — instead of in the middle.

It would be nice if we could either specify this 0.5f (or 1.0f) as a property instead of it being hard coded.

stuffmc commented 11 years ago

As a side note 1.0f has a bit of a weird side-effect where I can't push anything anymore to the navigationController being in the ScrollView... But 0.9f for example works fine. I might try a higher value (e.g. 0.95f) but there's very little chance people "swipe" that far to the right/left so even 0.9f should be fine.