Skip to content

Instantly share code, notes, and snippets.

@eggmobile
eggmobile / file0.m
Created December 10, 2013 12:23
iOS向けGoogle Analytics v3の設定についてメモ ref: http://qiita.com/eggmobile/items/ebffa22a1afb0d930f32
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
...
// Google アナリティクス
#import "GAI.h" //※ここを追記
#endif
@eggmobile
eggmobile / file0.m
Created September 6, 2013 08:35
CoreDataでUISearchBarからの検索を速くする ref: http://qiita.com/eggmobile/items/208b1c311320516faa02
- (void)filterContentForSearchText:(NSString*)searchText
scope:(NSString*)scope
{
NSString *query = self.searchDisplayController.searchBar.text;
NSPredicate *namePred; // 名前用のPredicate
if([query length] == 0) {
return;
}else if ([query length] == 1) { // 検索窓に一文字しか入力されなかったときは、firstLetterから探す
@eggmobile
eggmobile / file0.txt
Created June 18, 2012 05:03
NSDictionaryの入ったNSArrayを特定のキーでソートする ref: http://qiita.com/items/cef3670973619db54e6c
//高速列挙ではソートはしてくれないため、NSSortDescriptorを使います。
//ソート対象となるキーを指定した、NSSortDescriptorの生成
NSSortDescriptor *sortDescNumber;
sortDescNumber = [[NSSortDescriptor alloc] initWithKey:@"key" ascending:YES];
// NSSortDescriptorは配列に入れてNSArrayに渡す
NSArray *sortDescArray;
sortDescArray = [NSArray arrayWithObjects:sortDescNumber, nil];
// ソートの実行
NSArray *sortArray;
sortArray = [timePeriodArray sortedArrayUsingDescriptors:sortDescArray];