InstrumentsのTime Profilerを使用する。
Call Treeのチェックマークは
Invert Call Tree
Hide Missing Symbol
Hide System Libraries
InstrumentsのTime Profilerを使用する。
Call Treeのチェックマークは
Invert Call Tree
Hide Missing Symbol
Hide System Libraries
| iPhone用のxibファイルを選択して[File] - [Duplicate]を選択して名前の最後に~iPadをつける。 | |
| ~iPad.xibを右クリックして[Open As] - [Source Code]で開く | |
| type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" を | |
| type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" に置換。 | |
| targetRuntime="iOS.CocoaTouch" を | |
| targetRuntime="iOS.CocoaTouch.iPad" に置換。 |
| // immutableなString型の配列 | |
| let names: String[] = ["name5", "name2", "name1", "name3"] | |
| //各データを取得 | |
| let name1 = names[0] //name5 | |
| let name2 = names[1] //name2 | |
| let name3 = names[2] //name1 | |
| let name4 = names[3] //name3 | |
| //各件数 |
| //集計対象 | |
| NSExpression *keyPathExpression = [NSExpression expressionForKeyPath:@"column1"]; | |
| //集計関数countを指定 | |
| NSExpression *countExpression = [NSExpression expressionForFunction:@"count:" arguments:@[keyPathExpression]]; | |
| //集計式の対象(NSExpressionDescription ) | |
| NSExpressionDescription *expressionDescription = [[[NSExpressionDescription alloc] init] autorelease]; | |
| [expressionDescription setName:@"count"]; | |
| [expressionDescription setExpression:countExpression]; | |
| [expressionDescription setExpressionResultType:NSInteger32AttributeType]; |
| ja.lprojとen.lprojフォルダを作成してそれぞれの言語ファイルを同じ名前で入れる。 | |
| en.lprojフォルダ配下は自動で認識されるがja.lprojフォルダ配下は[Target Membership]にチェックが外れているのでチェックを入れればローカライズされる。 |
| + (UIColor *)colorWithHexString:(NSString *)hex | |
| { | |
| //先頭に#がついていた場合は#を削除 | |
| if ([hex hasPrefix:@"#"]) { | |
| hex = [hex substringFromIndex:1]; | |
| } | |
| unsigned int rgb[3]; | |
| for (int i = 0; i < 3; i++) { | |
| NSString *component = [hex substringWithRange:NSMakeRange(i * 2, 2)]; | |
| NSScanner *scanner = [NSScanner scannerWithString:component]; |
| //ステータスバー領域を含む画面の領域 | |
| CGRect bounds = [UIScreen mainScreen].bounds; | |
| ステータスバー領域を含まない画面の領域 | |
| CGRect applicationFrame = [UIScreen mainScreen].applicationFrame; |
| //全文 | |
| NSString* html = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].outerHTML"]; | |
| //bodyタグ内 | |
| NSString* html = [webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]; |
| //UIImageのリサイズ | |
| - (UIImage *)resizeImage:(UIImage *)image rect:(CGRect)rect | |
| { | |
| UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); | |
| [image drawInRect:rect]; | |
| UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextSetInterpolationQuality(context, kCGInterpolationHigh); | |
| UIGraphicsEndImageContext(); | |
| return resizedImage; |
| - (id)initWithDictionary:(NSDictionary *)dict managedContext:(NSManagedObjectContext *)context | |
| { | |
| self = [super initWithEntity:[NSEntityDescription entityForName:[[self class] entityName] inManagedObjectContext:context] insertIntoManagedObjectContext:nil]; | |
| if (self) { | |
| for (NSString *key in dict.allKeys) { | |
| [self setValue:dict[key] forKey:key]; | |
| } | |
| } |