Giter Club home page Giter Club logo

xbpagecurl's Introduction

XBPageCurl

XBPageCurl is a free and open-source implementation of a page curl animation/transition for views in iOS that intends to mimic the behavior of the pages in apps like iBooks and GoogleMaps for iOS.

It uses OpenGL ES 2.0 to draw a deformed mesh of triangles. Conceptually, it projects the vertices of the mesh on a virtual cylinder that rolls on the view. You can move, rotate and change the radius of the cylinder, with or without animation. The mesh follows the cylinder as it moves. The mesh deformation is performed in a crazy vertex shader which makes it really fast.

Uncurled Curled

Concepts

The concept behind this page curl effect is that of a virtual cylinder that slides on top of the page and everything that is on the right of this cylinder curls around it till the top of the cylinder and then it continues in a horizontal flat plane, hence showing the back of the page. The cylinder can be moved and rotated and its radius can change. The position of the cylinder is actually any point in its axis projected on the xy-plane, hence any point in the same axis results in the same cylinder.

Concept

How to use

Basically, XBPageCurl can be used in two different ways. It can be used to curl a view and show another view behind it where the user can interact with its elements and then uncurl the view back, pretty much like in the Google Maps app (Simple Curl sample). It can also be used to flip pages like in iBooks, where the user can drag the border of a page and release to flip it or cancel the flip (Page Curl sample).

Using XBCurlView

XBCurlView is a low level class that does the actual work for curling the view. It has methods for drawing views or images in one of its three pages (front and back of the page being curled and the next page) and for controlling the cylinder that moves around on top the curling view. It can be used to curl a view to show another view behind it like in Google Maps, or to do another customized view curl transition.

To use it, you first have to initialize an instance using the initializer that best satisfies your needs. The initWithFrame: initializer is a good start, it will create a grid mesh with a resolution proportional to the frame size, which gives good results for cylinder radius above 20. The initWithFrame:antialiasing: allows you to specify whether you want to switch on the Open GL ES Multisampling Antialiasing to get smoother edges. The initWithFrame:horizontalResolution:verticalResolution:antialiasing allows you to choose the mesh resolution (amount of rows and columns on the grid mesh), which you should try to keep proportional to the frame size in order to get a grid of squares, not rectangles. You should only worry about the mesh resolution if you start to see the shapes of the triangles on the curled section of the mesh, which can be smoothed out by increasing the resolution.

A simple way to curl an arbitrary view is to call the helper methods -[XBCurlView curlView:cylinderPosition:cylinderAngle:cylinderRadius:animatedWithDuration:] and -[XBCurlView uncurlAnimatedWithDuration:] which will do all the work for adding the XBCurlView instance as subview and removing the view to be curled from its superview and then add it back after the uncurl animation. Its usage is self explanatory and you can see an example of its usage in the RootViewController's button actions methods in the sample application.

If you want more control, you have to handle the setup process yourself, which will usually look pretty much like the steps taken in the -[XBCurlView curlView:cylinderPosition:cylinderAngle:cylinderRadius:animatedWithDuration:] and -[XBCurlView uncurlAnimatedWithDuration:] methods. After you initialize a XBCurlView instance, you should draw the view or image you want to curl on it using drawViewOnFrontOfPage: or drawImageOnFrontOfPage:, which draws the view or image in the front of the mesh that will curl. You should also set opaque to NO on the XBCurlView instance in order to see through it on the region the page does not cover, which allows you to see the views behind the XBCurlView and interact with them.

To curl the view back, just set its cylinder position, orientation and radius back to initial state with animation and for one of them assign a completion block that should add the original view back again, remove the XBCurlView instance from its superview and also call stopAnimating to stop the OpenGL ES rendering loop.

//Initializing a XBCurlView instance in viewDidLoad in the root view controller
- (void)viewDidLoad
{
    [super viewDidLoad];
        
    CGRect r = CGRectZero;
    r.size = self.view.bounds.size;
    self.curlView = [[[XBCurlView alloc] initWithFrame:r] autorelease];
    [self.curlView drawViewOnFrontOfPage:self.messyView];
    self.curlView.opaque = NO;
}

Whenever you want to curl the view, first draw it again on the front of the page to update the image on the curling mesh, set the initial cylinder properties, then set the final properties with animation, add the XBCurlView instance as a subview of the superview of the view you are gonna curl so that it is above that view, and remove the other view from its superview so that the other view behind it will appear. Lastly, you have to call startAnimating on the XBCurlView instance for it to start rendering the OpenGL ES stuff. You can stop the animation with stopAnimating after the animation completes (use the animation completion block for that).

GRect frame = self.view.frame;
double angle = M_PI/2.5;
//Reset cylinder properties, positioning it on the right side, oriented vertically
self.curlView.cylinderPosition = CGPointMake(frame.size.width, frame.size.height/2);
self.curlView.cylinderAngle = M_PI_2;
self.curlView.cylinderRadius = 20;
//Update the view drawn on the front of the curling page
[self.curlView drawViewOnFrontOfPage:self.messyView];
//Start the cylinder animation
[self.curlView setCylinderPosition:CGPointMake(frame.size.width/6, frame.size.height/2) animatedWithDuration:kDuration];
[self.curlView setCylinderDirection:CGPointMake(cos(angle), sin(angle)) animatedWithDuration:kDuration];
[self.curlView setCylinderRadius:UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad? 160: 70 animatedWithDuration:kDuration completion:^{
    [self stopAnimating]; //Stop the OpenGL animation loop after these animations are finished
}];
//Setup the view hierarchy
[self.view addSubview:self.curlView];
[self.messyView removeFromSuperview];
//Start the rendering loop
[self.curlView startAnimating];

To curl the view back, just set its cylinder position, orientation and radius with animation and for one of them assign a completion block that should add the original view back again, remove the XBCurlView instance from its superview and also call stopAnimating to stop the rendering loop.

CGRect frame = self.view.frame;
//Animate the cylinder back to its start position at the right side of the screen, oriented vertically
[self.curlView setCylinderPosition:CGPointMake(frame.size.width, frame.size.height/2) animatedWithDuration:kDuration];
[self.curlView setCylinderDirection:CGPointMake(0,1) animatedWithDuration:kDuration];
[self.curlView setCylinderRadius:20 animatedWithDuration:kDuration completion:^(void) {
    //Setup the view hierarchy properly after the animation is finished
    [self.view addSubview:self.messyView];
    [self.curlView removeFromSuperview];
    //Stop the rendering loop since the curlView won't appear at the moment
    [self.curlView stopAnimating];
}];
//Start the rendering loop
[self.curlView startAnimating];

You can find a working implementation of these steps in -[XBCurlView curlView:cylinderPosition:cylinderAngle:cylinderRadius:animatedWithDuration:] and -[XBCurlView uncurlAnimatedWithDuration:].

Note that the XBCurlView does not support frame changes while it is rendering. Hence be careful when doing interface orientation changes.

Using XBPageCurlView

XBPageCurlView is a view that has support for dragging the page with a finger like in a book. It is a subclass of XBCurlView that adds touch handling to it. It controls the cylinder so that the corner of the page will follow the user's finger. It also supports snapping points (XBSnappingPoint class) that the cylinder can stick to and a protocol that warns its delegate before and after sticking to a snapping point. The usage is pretty much the same as the XBCurlView.

XBPageDragView

XBPageDragView is a view that will automatically create and animate a XBPageCurlView whenever a finger is dragged on it. Just create one instance of it (in Interface Builder or programmatically), set the view it should curl in its viewToCurl property and you're all set. Since the page mesh depends on the size of the view to curl, you should call -[XBPageDragView refreshPageCurlView] whenever the frame of that view changes. Look into PageCurlViewController* for details.

xbpagecurl's People

Contributors

joshim5 avatar m3ta4a avatar marcpalmer avatar xissburg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xbpagecurl's Issues

"Light-weight" curl mode

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.

User Interaction with curled view

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.

The page curl from top right instead of bottom right...

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];

Animation issue during "uncurl"

Hi,

In the "Page Curl" demo of sample application:

  • Curling by dragging from bottom right to top centre.
    • Page bottom right corner follows the finger touch position. - OK.
  • Uncurling by dragging back to the original position with reverse movement path (top centre to bottom right)
    • Expected to have reverse animation effect when comparing with the "curling animation" but it's not.
    • Observation 1: The finger must be tapping exactly on the page corner "tip" in top centre to have the correct animation.
    • Observation 2: Tapping in other positions may cause the top right page to be curled. It's hard to fully uncurl.

Is this the expected behaviour?

Thank you.

Crash if viewUnloads during animation and rotation

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.

Other side of curled page

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

Demo is buggy

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.

Visual Issue

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.

Landscape curling problem

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!

Using XBPageDragView with specific conformations?

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!

Curled View Cut off In Simple Curl

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!

Weird behavior of the example project

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:

untitled-1

untitled-2

untitled-3

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.

Using XBPageCurl With Google Maps SDK for iOS

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---------------------------------------------------------------------------------

Here are some images:
ios simulator screen shot may 15 2013 9 14 10 pm
ios simulator screen shot may 15 2013 9 14 15 pm

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?

ibook like peeling to the next view .

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.

Animation issue

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+.

Curl XBPageDragView on Tap

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?

XBCurlView from bottom left instead of bottom right

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

Curl from left to right

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?

Render calculations outside the main thread and animation caching

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.

Possible Memory Leak

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

Occasional EXC_BAD_ACCESS in XBAnimationManager.m

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.

Is it possible to curl from left to right currently?

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.

XBPageCurl on multipleView

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

curlImage

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;
    }

Can I anchor the curl angle

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?

OpenGL crash

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

How to render a view on the back face?

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?

XBPageDragView curl with tap

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

Drag XBPageDragView from top left to bottom right

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.

Restrict Curl

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.

Retina Display support

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.

Does Anitaliasing work?

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?

Visual glitches with small radius

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!

Problems initializing when XBPageDragView is used in a StoryBoard

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.

Make XBPageDragView only curl up/down

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

gpus_ReturnNotPermittedKillClient crash

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.

run on device

the code work fine on simulator but when install on device (ipad1) give me a 506 error, which is GL_INVALID_FRAMEBUFFER_OPERATION

Curling a subview inside a table cell causes diagonal distortion

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:
Working

Here's the same curl applied to a subview inside the cell:
Not Working

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.

Possible change to support drawing outside the viewToCurl?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.