honcheng / PaperFold-for-iOS

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

Top and bottom views not unfolding. #39

Open jallenbrown opened 11 years ago

jallenbrown commented 11 years ago

When I call either:

 [self.paperFoldView setPaperFoldState:PaperFoldStateTopUnfolded];

 or 

 [self.paperFoldView setPaperFoldState:PaperFoldStateBottomUnfolded];

the unfolding animation never happens and it gets stuck in a never ending loop inside

 - (void)unfoldTopView:(NSTimer*)timer 

 or

 - (void)unfoldBottomView:(NSTimer*)timer 

At first glance it looks like the transform.ty is not being updated so the frame height never changes. Not sure where to go from here.

funkyboy commented 11 years ago

Been digging a bit. Looks like ty is always 0.

- (void)unfoldTopView:(NSTimer*)timer { [self.topFoldView setHidden:NO]; [self.bottomFoldView setHidden:NO]; [self.leftFoldView setHidden:YES]; [self.rightFoldView setHidden:YES]; CGAffineTransform transform = [self.contentView transform]; float y = transform.ty + (self.topFoldView.frame.size.height-transform.ty)/8; NSLog(@"ty is: %g ", transform.ty); ... }

Any hint?

funkyboy commented 11 years ago

Send a pull request. Don't know if it's the most "correct" way to solve it but it works.

amanstein commented 11 years ago

don't know why, but just setting topViewPullFactor = 0 works! e.g.

[_paperFoldView setTopFoldContentView:self.topContentView topViewFoldCount:3 topViewPullFactor:0];