matsuda
8/22/2011 - 3:22 AM

Objective-CのUIView関連のスニペット

Objective-CのUIView関連のスニペット

/*
 再帰的に子viewを表示
 */
@interface UIView (PrivateAPI)
- (NSString *)recursiveDescription;
@end

// view is UIView's object
NSLog(@"%@", [view recursiveDescription]);
/*
 UIWebViewのUserAgentを取得
 */
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString *ua = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
NSLog(@"userAgent >>> %@", ua);
[webView release];
// ASIHTTPRequestにUserAgentを設定
// [ASIHTTPRequest setDefaultUserAgentString:ua];