Skip to content

Instantly share code, notes, and snippets.

@matsuda
Last active September 26, 2015 21:27
Show Gist options
  • Save matsuda/1161588 to your computer and use it in GitHub Desktop.
Save matsuda/1161588 to your computer and use it in GitHub Desktop.
Objective-CのUIView関連のスニペット
/*
UIWebViewのUserAgentを取得
*/
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString *ua = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
NSLog(@"userAgent >>> %@", ua);
[webView release];
// ASIHTTPRequestにUserAgentを設定
// [ASIHTTPRequest setDefaultUserAgentString:ua];
/*
再帰的に子viewを表示
*/
@interface UIView (PrivateAPI)
- (NSString *)recursiveDescription;
@end
// view is UIView's object
NSLog(@"%@", [view recursiveDescription]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment