xissburg / xbpagecurl Goto Github PK
View Code? Open in Web Editor NEWA decent page curl transition for iOS.
License: MIT License
A decent page curl transition for iOS.
License: MIT License
Hi,
In the "Page Curl" demo of sample application:
Is this the expected behaviour?
Thank you.
For example, if the keyboard becomes first responder, it cannot be closed easily. I 'curled' the page, hit the UITextField, and then could not uncurl.
Maybe the Multiple example isn't relevant for iPad? Not sure.
Have you seen this crash before?
0 libGPUSupportMercury.dylib 0x3978de22 gpus_ReturnNotPermittedKillClient + 10
1 libGPUSupportMercury.dylib 0x3978e754 gpusSubmitDataBuffers + 120
2 libGPUSupportMercury.dylib 0x3978e5f6 gldCreateContext + 186
3 GLEngine 0x31f84b12 gliCreateContextWithShared + 674
4 OpenGLES 0x3760e91a -[EAGLContext initWithAPI:properties:] + 1430
5 OpenGLES 0x3760e2d2 -[EAGLContext initWithAPI:sharedWithCompute:] + 138
6 TestApp 0x001863ba -XBCurlView initialize
7 TestApp 0x001867fc -XBCurlView initWithFrame:horizontalResolution:verticalResolution:antialiasing:
8 TestApp 0x0018677e -XBCurlView initWithFrame:antialiasing:
9 TestApp 0x00186726 -XBCurlView initWithFrame:
From these links it appears that we need to add special handling in the AppDelegate to make sure we don't call OpenGL code while in the background.
http://developer.apple.com/library/ios/#qa/qa1766/_index.html
http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ImplementingaMultitasking-awareOpenGLESApplication/ImplementingaMultitasking-awareOpenGLESApplication.html#//apple_ref/doc/uid/TP40008793-CH5-SW1
I didn't see that your sample app does this. Have you seen this before and would you recommend that I follow the suggestions in those links?
I appreciate any insight you have.
Thanks.
First of all, thank you so much for your excellent XBPageCurl class. This is awesome.
I'm not sure if this is an issue, or whether it's something I've just been unable to figure out:
I'm curling a view that does not cover the full screen. It is a subview that is effectively surrounded on all sides by a margin. The curl works, but when I curl the page with the cylinder at an angle, any part of the curled "page" that falls outside of the bounds of the XBCurlView is cut off. This seems reasonable, but when I try to change the size of the XBCurlView instance before calling "curlView: cylinderPosition: cylinderAngle: cylinderRadius: animatedWithDuration:" it offsets the curledView.
Is there another way to do this, or this functionality not supported yet?
Thank you so much!
Using XBPageCurlView, if I set the cylinder radius to 10 or less the outside edge of the curl renders very jagged. Is there anything I can adjust to make it so the edge is smooth at this radius? At 15 or 20 it looks fine. The reason for the small radius is that I am turning down the top left corner to create a sort of dog eared look on the page, when the user drags it out the radius increases to something more typical.
Any ideas would be appreciated.
Thanks!
Applying a curl using XBCurlView to a UITableViewCell works fine, but trying to apply a curl to any subview inside the cell creates strange diagonal distortion when the curl view is rendered.
Here's the curl applied to the cell:
Here's the same curl applied to a subview inside the cell:
This same issue happens with any type of subview inside a table cell, so it doesn't appear to just be limited to image views.
Hi! I'm having an issue with XBPageCurl. The first time I play the transition animation, the backview is being flashed on the screen. This even happens in your own example. Just in case it matters, I'm compiling it with iOS SDK 4.0+.
When the curled face has transparacy the shadow gets multiplied all over the screen.
screenshot: http://www.martinjansson.se/xbpagecurl_shadow_issue.png
If the curled view or image has transparency que opengl overlay gets a black background.
Hi,
I am trying to use this library to curl down the corner of a view and keep it curled down. I just curl the very top corner, so I want the user to be able to continue to interact with the rest of the view while it is curled. Right now, this doesn't seem possible. I started from the SimplePageCurl example and just changed the positions and angles to get it to curl from the top right corner. Now it seems like the curled view is just an image and I can't interact with the controls on the screen.
Any advice would be very appreciated.
Very cool library so far. It looks like it will really help me if I can get past this one issue.
I have a problem in curling views in landscape orientation. In this case, the content of the XBCurlView is transformed into its portrait orientation and the curling is rendered for portrait on my landscape view. Since the portrait height is larger than the landscape height, the curling effect starts off the screen and curls upwards. At the left side of the screen i only see my background (which is white in this case, since i didn't draw another view as background).
I assume that in case of landscape you should exchange the view.bounds.size.width and .height. At first sight I couldn't fix the problem, so maybe you can have a look into the problem.
Nevertheless, thank you for sharing this very nice piece of code with us!
Is it possible to have a custom image instead of the "mirrored grayed out image" on the other side of the curled top view (back of the top page), basically i want to curl a playing card lying face down and see what card i have.
Thanks a bunch
its not an issue but I thought maybe someone have example how to implement it.
Hello,
I have two questions:
First. It takes some time between user tapped "curl" button and the view starts to curl with the animation. Is it possible to take this rendering calculations outside the main thread, so the UI won't froze?
Second. I noticed, that when animation performed for the first time in the app, it's sometimes have lower performance, than in next times. I guess, it's because it already cached when it performs for the next time. I wonder if it's possible to force-cache it before the real animation, so it would always worked smooth when it's curled for the first time.
Thanks.
Due to my last issue (#41) another question occurred to me: How would i make the XBPageDragView curl on a single tap?
Should i add a UITapGestureRecognizer to the XBPageDragView which calls the XBPageDragViews pageCurlView touchEndedAtPoint: method with CGPointMake(self.viewToCurl.frame.size.width_0.5, self.viewToCurl.frame.size.height_0.67) or is there a proper solution?
Hello,
first i want to tell you that this is a great piece of software - thank you.
My problem is the following. I try to achieve similar behaviour like the Apple Maps App and have some issues which i would like to change. The first one is that i would like to see the dog-ear effect all the time. The second one is, if the view is curled and i want to uncurl it, it looks kind of ugly because a simple tap doesn't uncurl it - i have to drag down the view which causes it to curl from up to down. After the touch ends it moves back. Would it be possible to "glue" the top and left side of the view so curling would only be possible from bottom/right?
I hope you understand what i am talking about and maybe you have an advice for me.
Kind regards
Jan
Would you mind adding a tag for Cocoapods to reference?
I'm trying to update the podspec and apparently they require a tag reference.
i was curled a uiview on ipad,the view was not full screen. it's about 1/4 size,but the curl page was a mess.
here's the screen capture: http://photo.163.com/xjrad/#m=2&aid=241313633&pid=7752721790
thanks.
when i run your app,it give me a mistake <GHUnitIOS/GHUnit.h> not found
I can't see how to do this - there doesn't seem to be support for the curl direction - I basically want the inverse of what is there now, like dragging the left page of a two-page spread book in iBooks.
I imagine this "just" means inverting some angles. Do you think it is much work? Any pointers would be much appreciated, and of course I will make pull requests as necessary.
Hi,
as in the example I created a dragview to curl a view, it works perfectly.
I want it to curl not only with the swipe but also with the tap, so I put a tap gesture recognizer on dragview, which method do I call to bend it?
Thanks
I'm playing with Page Curl of the provided Curl Demos.
I'm tapping on the same point of the hot area in the bottom right area (I marked this point in red on the screenshots). And I'm getting 3 different results randomly:
The desirable result is shown on the first screenshot, and I don't know how to get it every time. I didn't find any regularity in the results. The result shown on the last screenshot is very annoying and often reproducible when you navigate to the Page Curl the very first time.
Please, help.
Is it possble to use EAGLView as the page curled Instead of common UIView, and how?
Just encountered this crash while testing in the simulator:
�[;(lldb) bt
* thread #1: tid = 0x1c03, 0x1be03018, stop reason = EXC_??? (11) (code=0, subcode=0x0)
frame #0: 0x1be03018
frame #1: 0x1be01745
frame #2: 0x142b9575 GLRendererFloat`gldRenderFillTriangleStrip + 129
frame #3: 0x1be022f0
frame #4: 0x152a6dcc GLEngine`gleDrawArraysOrElements_ExecCore + 980
frame #5: 0x152a1f2b GLEngine`glDrawArrays_IMM_ES2Exec + 267
frame #6: 0x01668116 OpenGLES`glDrawArrays + 57
frame #7: 0x000f1b09 TestApp`-[XBCurlView draw:] + 1289 at XBCurlView.m:1076
frame #8: 0x00a852d2 QuartzCore`CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 110
frame #9: 0x00a8575f QuartzCore`CA::Display::TimerDisplayLink::callback(__CFRunLoopTimer*, void*) + 161
frame #10: 0x02245376 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
frame #11: 0x02244e06 CoreFoundation`__CFRunLoopDoTimer + 534
frame #12: 0x0222ca82 CoreFoundation`__CFRunLoopRun + 1810
frame #13: 0x0222bf44 CoreFoundation`CFRunLoopRunSpecific + 276
frame #14: 0x0222be1b CoreFoundation`CFRunLoopRunInMode + 123
frame #15: 0x024be7e3 GraphicsServices`GSEventRunModal + 88
frame #16: 0x024be668 GraphicsServices`GSEventRun + 104
frame #17: 0x00bba65c UIKit`UIApplicationMain + 1211
frame #18: 0x00002e9d TestApp`main + 141 at main.m:16
0x1be03018: movaps %xmm3, %xmm7
0x1be0301b: subps %xmm1, %xmm7
0x1be0301e: movaps -3544(%ebp), %xmm1
0x1be03025: movaps %xmm1, %xmm5
0x1be03028: movss %xmm7, %xmm5
0x1be0302c: shufps $36, %xmm5, %xmm1
0x1be03030: movaps -2552(%ebp), %xmm5
Hello!
Excellent library, amazing work! I'm building an eReader of sorts, and turned to your library after failed attempts with others.
I'm shooting for a specific effect using XBPageDragView. I only want horizontal curl (no vertical) that follows the users drag, and when they release continues the effect and moves off the page. I'm a new iOS developer (started a few days ago) and I've been using the sample, but because of a weaker grasp of the code I'm having difficulty getting the exact effect I'm looking for.
Any suggestions? I've been working with it for the past 2 days and finally decided to ask...thanks in advance!
I'm getting an occasional crash which I think is being caused by the
[self.animations removeObjectsForKeys:finishedAnimationKeys];
line in XBAnimationManager.m. From the stack trace, the call causing the exception is
-[NSMutableDictionary removeObjectsForKeys:]
It's occurring when the view controller containing the animation gets pushed off the navigation controller stack, but it's only intermittent - I haven't been able to reproduce it consistently.
Hi Xiss,
How can I draw a view on the backside of the curling view? I'm not sure whether this is already implemented, but I couldn't find a mechanism. There is a backTexture in XBCurlView.h, but it seems that is not used. Do you have a plan to implement this feature or am I missing something?
I'm a total noob wrt OpenGL so forgive me if the answer is obvious. I'm using XBPage curl to create a children's book/app. Everything seems to be working great but I've got what appears to be a massive memory leak in the textures. I'm 'turning' a full page landscape page on the iPad. I've altered the program for testing purposes to release each page when done. This is slow but I'm just trying to track down the leak. Every time I turn the page my memory allocation increases by about 12-15MB. Instruments show's no leaks and neither does Analyze in XCode tag anything. I have extended XBCurlView with my own ABPageCurlView class because I need two-page turns at once (center -> out and outside -> center) .
Instruments show something like this under [XBCurlView draw:], [XBCurlView createFrameBuffer:] , and a couple of other calls
Bytes Used Count Symbol Name
6.00 MB 23.9% 4 glsmLoadTextureStructure
6.00 MB 23.9% 4 glsmLoadTextureLevelBuffer
6.00 MB 23.9% 4 malloc
I've gone through the XBCurlView code and it seems to have most glDestroyTexture in the right place although it wan't clear for backGradientTexture and frontTexture. I added the following to make sure they weren't being unnecessarily recreated.
line 112:
if (frontTexture == 0) {
frontTexture = [self generateTexture];
}
line 912:
if (backGradientTexture == 0) {
backGradientTexture = [self generateTexture];
}
but this was not the problem.
Has anyone else seen this? Am I doing something stupid?
Thanks,
Scott
I tried a simple test in the sample code of changing
self.curlView = [[[XBCurlView alloc] initWithFrame:r] autorelease];
to
self.curlView = [[[XBCurlView alloc] initWithFrame:r antialiasing:YES] autorelease];
in SimpleCurlViewController.m to see the visual impact of antialiasing but after doing this the curl doesn't work. In the PageCurlViewController the equivalent changes allows the curl to start and then freeze with about a 20 pixel area curled.
Should this work?
In my application, through various user actions, the XBCUrlView might be unloaded during an animation.
When my ViewController's viewDidUnload method gets called, I call [xbCurlView stopAnimation] and release my xbCurlView. I subsequently see that XBCurlView dealloc gets called and all the member variables get nil'd out.
AFTER this, I get another call to XBCurlView draw. It appears that even though I called [XBCurlView stopAnimation] and it called self.displayLink.invalidate, the runLoop is still calling draw one more time. At this point self.context is nil and I get a crash.
Is there any way to stop the run loop from calling draw again?
One odd thing in stopAnimation, the retainCount is 2 before [self.displayLink invalidate] and 2 after.
Another note is that the crash only occurs if the user takes an action that should dismiss the curlView and then rotates immediately. Could it be that the rotate action cues up a call to [XBCurlView draw] which doesn't get cleared by invalidate?
I've done a lot of debugging and am sure that everything is happening on the same thread and all calls involve a single XBCurlView and a single CADisplayLink. I am totally confused and can only assume that this is a bug in CADisplayLink.
Hi,
I want to change the direction for XBPageDragView. Direction should from top left to bottom right. In other words, I want to drag the view from top left to bottom right. Any idea how to do this.
The code are very well down. Thanks for your generous offering the code.
There still some visual Issue about this code that make this Curl effect unrealistic. The Gradient effect of the page's gap is pretty dark, and there's no shadow between the cylinder and bottom view.
Why is it that when I try to curl the view that contains the googleMapView (front View) the map gets black? Am I doing something wrong? Is it a bug? or XBpageCurl is not compatible with Google Maps SDK for iOS? I have change the map from the apple's map where the curl worked perfectly. Thanks for the reply.
-----------------------------------------------------------------------EDIT---------------------------------------------------------------------------------
I'm using 3 View's like the example (backView, frontView, peelView). More info: Google Maps SDK for iOS version that I'm using is: 1.3.0 (current) & I'm using storyboards.
Idk if this is going to help but I have made a project with the same approach I'm using on my main workplace and it's on Bitbucket. Here's the link:
https://[email protected]/942v/test-xbpagecurl-google-maps-sdk-for-ios.git
You need an API Key from Google. Specifically for Google Maps SDK for iOS. Visit: "https://code.google.com/apis/console/"
Please go to "GoogleAPIKey.h" and put your key before running it on the simulator.
Can you tell me what I'm doing wrong?
Hi,
I'm pretty new to this, but I found that I couldn't get XBPageDragView to init properly when referenced from my root viewcontroller's view in the app storyboard. The problem was that when the NIB loader calls setViewToCurl, the frame of the viewToCurl has not yet been set (perhaps this is because I'm using auto layout?).
I managed to establish that calling refreshPageCurlView from viewDidAppear will work around this, but we do then have a bunch of false init where the frame is 0,0,0,0 and hence the OGL framebuffer inits fail.
It still works, but I'm thinking that the setter for viewToCurl should not be calling refreshPageCurlView and we should be doing this from somewhere else instead.
Hi,
It seems that if you have a view that is not full screen size, that the curled corner (not the one being dragged) clips to the bounds of the viewToCurl. masksToBounds = NO does not help here, I presume because the EAGL layer is being created with the frame of the viewToCurl as dimensions.
Surely we should be able to support this so that the shadow and page corners render outside of the view bounds. How would we do this? Create the EAGLLayer with full screen dimensions (or a rect from a property) and masksToBounds = NO?
I can probably hack this for now by adding clear space to the top of my viewToCurl, so there is space for the top corner of my "paper" to render - but shadows will still not extend outside of the bounds. If you imagine a "paper" view with a background of wood behind and around it, you want the shadow to continue outside of the paper's rect.
Hi there,
Awesome library !
I am trying to implement a feature which is like an ibook peeling animation. I want to entirely peel off the first screen when a user drags a curlview for more than 50%.
Could you please suggest me how to achieve this ?
Thanks.
I have a UIScrollView with some data. In the corner of it I place XBCurlView. So, while part of scrollView is curled, user can still scroll it. Therefore I need to update curl texture everytime in scrollView delegate -(void)scrollViewDidScroll:(UIScrollView *)scrollView. This makes scrolling unsmooth.
I'm woundering, is it possible to make "light" mode of the curl, when it doesn't use texture and doesn't curve it - just simple curled page corner with shadows.
Thanks.
In the readme you make reference to being able to set the direction of the curl, but I see the API has changed a little. If I wanted it to curl up from the bottom left what do you recommend that I change in terms of parameters in XBCurlView?
Thanks
Multisampling antialiasing seem to not directly map texels to pixels, making the view/image blurry.
Can I tweak the shadow that it more looks like in Maps.app?
XBPageCurl: http://d.pr/i/fLZU
Maps.app: http://d.pr/i/hmpf
Right now, the curled flipside doesn't really contrast with the front side.
Cheers,
Ortwin
Hi, I have a fullscreen modal locked in horizontal orientation, with this 2 methods:
-(BOOL)shouldAutorotate{
return YES;
}
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
The device is an iPad2
When I curl the view this curl from top right instead of bottom right...this is the method to curl the view:
[self.curlView curlView:self.mappa cylinderPosition:CGPointMake(500, 400) cylinderAngle:M_PI_4 cylinderRadius:UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad? 160: 70 animatedWithDuration:DurataAnimazione];
I have my app set up nicely now and I can flip pages forward (i.e. I can turn pages from right to left). But how can I flip backwards? When I call XBCurlView->curlView and I set the starting point of the cylinder to the left X-coordinate of the screen, the curling takes place from left to right but the visual effect is the same as curling from right to left.
Is there an easy way to curl into another direction?
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?
I have an issue when I Try to draw the curl on a subView in UITableViewCell... only on the last cell the curl is drawn
the code is this :
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellCustom";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"View" owner:nil options:nil] objectAtIndex:0];
}
UIImageView * backImgView = (UIImageView * )[cell viewWithTag:-1];
[backImgView setBackgroundColor:[UIColor whiteColor]];
UIImageView * imgViewProdotto= (UIImageView *)[cell viewWithTag:1];
[imgViewProdotto setImage:[images objectAtIndex:indexPath.row]];
if(isCurl)
{
XBCurlView *curlView = [[XBCurlView alloc] initWithFrame:imgViewProdotto.frame antialiasing:YES];
CGRect r = imgViewProdotto.frame;
curlView.opaque = NO; //Transparency on the next page (so that the view behind curlView will appear)
// curlView.pageOpaque = YES; //The page to be curled has no transparency
[curlView drawViewOnFrontOfPage:imgViewProdotto];
[curlView curlView:imgViewProdotto cylinderPosition:CGPointMake(r.size.width/6, r.size.height/8) cylinderAngle:M_PI/3.2 cylinderRadius:UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad? 30: 70 animatedWithDuration:0.6];
}
return cell;
}
Hi!
I'm using XBPageDragView to curl my view by dragging.
I'm not sure if this can be achieved with this library and I was hoping someone could point me in the right direction.
Thanks for any help anyone can provide.
Appreciate your work,the page curl effect is cool.
I want to simulate the page curl from right bottom corner,but sometimes it acts all weird. Can I anchor the top corners so they don't curl from the top?
I want that it's always curl from right bottom corner,but sometimes when I tap on the right bottom corner it's curl from right top or left top to the point what I tap.
I can't adjust it by myself,any suggestion?
Views are not drawn in full resolution in Retina Display, it is actually drawn in half the display's resolution in the bottom left corner of the texture. Should draw in the Retina Display resolution.
The cylinder property values are not scaled according to the screen scale. The position and radius should be proportional to the screen scale, which is 2 in Retina Display, and 1 in a normal display.
the code work fine on simulator but when install on device (ipad1) give me a 506 error, which is GL_INVALID_FRAMEBUFFER_OPERATION
Hi,
How could the curl on the top right corner?
I use it to mark a page as a favorite.
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.