honcheng / PaperFold-for-iOS

Paper folding animation for iOS
Other
2.7k stars 399 forks source link

Fold animation not working for the first tim after setPaperFoldState:animated: if animated is NO #72

Open MihaiDamian opened 10 years ago

MihaiDamian commented 10 years ago

Steps to reproduce:

  1. Open the PaperFold project
  2. Insert this line in init after the views are setup: [_paperFoldView setPaperFoldState:PaperFoldStateLeftUnfolded animated:NO];
  3. Run the app and observe the left view. It is unfolded, as expected.
  4. Swipe left to fold the left view
  5. Instead of the left view folding it is simply covered by the center view

If you unfold the left view again and fold it it will work, but the first time it doesn't. This bug only happens if the state is set with animations turned off.

MihaiDamian commented 10 years ago

One workaround is to call foldWillOpen on the fold view that is unfolded by setPaperFoldState:animated:. Something like this: [_paperFoldView.leftFoldView foldWillOpen]; This seems to initialize some internal state in the MultiFoldView that seems to be missed by calling setPaperFoldState:animated: