Skip to content

Instantly share code, notes, and snippets.

#define UPDATE_ORIENTATION_NOTI CFSTR("iolate/UpdateOrientation")
static UIWindow* additionalWindow = nil;
static UIView* mainViewInWindow = nil;
static void updateOrientation(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
int orientation_ = 0;
UIWebClip *clip = [UIWebClip webClipWithIdentifier:nil];
//UIWebClip *clip = [UIWebClip webClipWithURL:[webpage.request.mainDocumentURL absoluteString]];
[clip retain];
[clip setPageURL:webpage.request.mainDocumentURL];
[clip setTitle:[webpage stringByEvaluatingJavaScriptFromString:@"document.title"]];
UIWebDocumentView *docView = nil;
UIScrollView *webpagescroller = [[webpage subviews] objectAtIndex:0];
for (UIView* aView in [webpagescroller subviews]){
if ([aView isKindOfClass:[NSClassFromString(@"UIWebBrowserView") class]]){
docView = (UIWebDocumentView *)aView;
@JatWaston
JatWaston / gist:5e317a59459c34289067
Created May 17, 2014 05:22
rotate image with degrees
- (UIImage *)imageRotatedByDegrees:(CGFloat)degrees image:(UIImage*)image
{
// calculate the size of the rotated view's containing box for our drawing space
UIView *rotatedViewBox = [[UIView alloc] initWithFrame:CGRectMake(0,0,image.size.width, image.size.height)];
CGAffineTransform t = CGAffineTransformMakeRotation(DegreesToRadians(degrees));
rotatedViewBox.transform = t;
CGSize rotatedSize = rotatedViewBox.frame.size;
[rotatedViewBox release];
// Create the bitmap context