iOS Objective-C Tips(1)

NSStringを指定文字列で分割

Split的な関数ですね。

NSString str = @"this,is,a,test";
NSArray array = [str componentsSeparatedByString:@","];

NSNullとは

NSNullクラスはNSArrayなどのコレクションオブジェクトにおいてnull値を表すのに使われる。

NSMutableArray *array = [NSMutableArray array];
[array addObject:[NSNull null]];

ステータスバーを非表示にするには

HogeAppDelegate.mで

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
    // Override point for customization after application launch.
	[application setStatusBarHidden:YES];

    // Add the view controller's view to the window and display.
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

    return YES;
}