Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to move page corner by touch point #14

Closed
xjrad opened this issue Dec 6, 2011 · 19 comments
Closed

how to move page corner by touch point #14

xjrad opened this issue Dec 6, 2011 · 19 comments

Comments

@xjrad
Copy link

xjrad commented Dec 6, 2011

thanks for your great work.
I want to move page corner by finger.It like google map on ipad do.How can i do this?

@xissburg
Copy link
Owner

xissburg commented Dec 6, 2011

I am gonna add a demo of this feature in the samples app as soon as possible.

Anyway, this can be achieved through the XBPageCurlView, but there are some stuff yet to be implemented.

@paraboul
Copy link

Hey,

Any update on this?

Thanks :)

@xissburg
Copy link
Owner

Hi, sorry for the delay.. I started to implement this but didn't commit anything yet. Been busy. I will try to continue to work on this feature this week.

@paraboul
Copy link

Awesome. Thanks

@xissburg
Copy link
Owner

I currently have the first working version in the branch "flip". I will continue to work on it to improve the API (suggestions are welcome) and I still have to implement correct dragging while the cylinder is snapped to another point.

The PageCurlViewController is the sample that uses this feature in a MapView. The process to make your view behave like that is quite manual yet. First you have to create a XBPageCurlView, configure it, add is as subview on top of the view you want to curl (add it to the superview of that one) and set it as hidden. Enable snapping and add some snapping points so that the cylinder will stick to them when the user releases his finger off the screen.

You also need another view that will act as a button that will start the curling (like in Google Maps for the iPad, where the "button" is the curled corner of the view on the bottom right of the screen). In the first touch, since the pageCurlView is hidden, we have to start to delegate the touches to it, hence you have to implement the touches* methods. In touchesBegan:withEvent: you also have to setup the pageCurlView for display and start its rendering loop.

One more thing that must be done is to implement XBPageCurlViewDelegate to be notified about snapping to the snapping point located at the bottom right which should stop the curlView and hide it and show the original mapView.

It's quite a lot of things to do to get this working yet :) . API suggestions are welcome.

@paraboul
Copy link

Hey,

Thanks, let me give it a try. I keep you in touch (no pun intented) ;)

@coder4567
Copy link

Hey I'm facing same issue, can't seem to figure out how to link the the finger touches to the curled page, all I managed to do is to put the curlView method in touchesEnded and it will curl the page to the position of the finger when touches ends, but if i put the method in touchesMoved, I will get a very odd behavior for it will try each time to curl a new page to the position of the finger, and it ends up curling the front View plus a bunch of shadows and it will not move with the finger.
I have another issue, since i'm working with epubs, I need to use a webview to display the content, and touchesBegan, touchesMoved and touchesEnded do not respond to the touches on the webview.
your help will be highly appreciated,
thank u in advance

@xissburg
Copy link
Owner

xissburg commented Jun 4, 2012

I had an idea for a simpler solution to this. I will try to crank it up today.

@xissburg
Copy link
Owner

xissburg commented Jun 7, 2012

Hey,

I have implemented that idea finally. There's a new sample called Page Curl that shows how to use the new feature. Basically, create an instance of XBPageDragView, place it somewhere (you can add any subviews into it) on your main view, set its viewToCurl property (it's an IBOutlet so you can link it in InterfaceBuilder), and you're all set already. Have a look in PageCurlViewController.* and PageCurlViewController_iPhone.xib to see how I did it. Quite simple. HTH

x

@coder4567
Copy link

Thank u, I truly appreciate it, I hope it works on webview I will try it right away.

@coder4567
Copy link

Its working perfectly thank u very much, just one tiny little problem, the dragging doesn't work on ipad1, same for simpleCurl, the animation of curling doesn't show on ipad1, it only works on ipad2 & 3 :s
Any idea why?
Anyway thk u again for ur efforts.

@xissburg
Copy link
Owner

xissburg commented Jun 8, 2012

Unfortunately I don't have an iPad 1 to test it here. Can you give more detail about what does not work? Error messages? Chashes? Have you tried debugging it to find the source of the problem?

@coder4567
Copy link

The problem is that XPageCurlView andXPageDragView don't show, for instance, in simple curl, when i click on curl button I directly see the backView, (no animation or curling occur) no clashes or errors shows in the console. When I click uncurl I'll see the front page back but again without any curling or any animation.
Thank u for ur assistance.

@coder4567
Copy link

Hy again, is it possible to make the curl in the opposite direction for arabic books as well?
thank u in advance,

@xissburg
Copy link
Owner

Well since I don't have an iPad 1 I can't reproduce this problem. If you could look further into it, you cant ix it and submit a pull request :)

Yea, I did not make the XBPageDragView flexible there yet. It must allow you to set the initial cylinder state so that you can drag from any direction. I will look into this later.

@coder4567
Copy link

Hy there, no prob, I had it tested on another ipad1 the prob didn't occur, so I guess its only that device.
I'm currently integrating the curl effect to my program, it works but the prob is: in CATransition only a layer of the view gets removed but in the curl effect you implemented the whole view gets removed, I'm currently trying to make some changes to make it work. Any advice would be appreciated, hope things work with the initial cylinder state.
Thank u again for ur assistance,

@coder4567
Copy link

Oh its fine I worked that out, Instead of hiding the curlView I update it and send to back. so no prob.

@xjrad
Copy link
Author

xjrad commented Jun 12, 2012

hi there,i download you latest code,it's works great.you'are amazing.

@xissburg
Copy link
Owner

Ok. I suggest you open a new issue for the page dragging direction thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants