You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the examples project, every page is rendered using core graphics. I have a UIView want to displaying in the next page, it's a grid view layout page. How to make it to show at the next page in the - (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx method?
The text was updated successfully, but these errors were encountered:
I needed to do just that too, so I went ahead and created an example of how to render a page from UIView. I will create a pull request for the added example in the XCode project.
- (void) renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx {
CGRect bounds = CGContextGetClipBoundingBox(ctx);
UIView* renderView = [[[UIView alloc] initWithFrame:bounds] autorelease];
renderView.backgroundColor = [UIColor colorWithHue:index/10.0saturation:0.8brightness:0.8alpha:1.0];
UILabel* label = [[[UILabel alloc] initWithFrame:bounds] autorelease];
label.text = [NSStringstringWithFormat:@"Page number %d", index];
label.textAlignment = UITextAlignmentCenter;
[renderView addSubview:label];
// View will render upside down if we omit this:CGAffineTransform verticalFlip = CGAffineTransformMake(1, 0, 0, -1, 0, bounds.size.height);
CGContextConcatCTM(ctx, verticalFlip);
// We call renderInContext on the layer to draw the view onto the context
[renderView.layer renderInContext:ctx];
}
In the examples project, every page is rendered using core graphics. I have a UIView want to displaying in the next page, it's a grid view layout page. How to make it to show at the next page in the - (void)renderPageAtIndex:(NSUInteger)index inContext:(CGContextRef)ctx method?
The text was updated successfully, but these errors were encountered: