This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 空の可変ディクショナリ生成例 | |
| NSMutableDictionary *mdic = [NSMutableDictionary dictionary]; | |
| // 値とキー値を指定した生成例 | |
| NSDictionary *dic = [NSDictionary dictionaryWithObject:@"hoge" forKey:@"Key"]; | |
| // 値とキー値を複数指定する生成例 | |
| NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys: | |
| @"hoge", @"name", | |
| @"999-9999-9999", @"tel", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 三項演算子例文 | |
| NSString *str = (a==b)?@"true":@"false"; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- dual table | |
| select 1; | |
| -- JST現在時刻を出力 | |
| select strftime('%Y-%m-%d %H:%M:%S', datetime('now', 'localtime')) as strftime; | |
| -- UTC時刻 | |
| select datetime('now'); | |
| select datetime('now', 'utc'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ファイルマネージャを作成 | |
| NSFileManager *fileManager = [NSFileManager defaultManager]; | |
| // ファイルが存在するか? | |
| if ([fileManager fileExistsAtPath:filePath]) { // yes | |
| NSLog(@"%@は既に存在しています", filePath); | |
| } else { | |
| NSLog(@"%@は存在していません", filePath); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Comboboxを初期化 | |
| [_directoryField selectItemAtIndex:0]; | |
| // Comboboxの選択されているindexを取得 | |
| [_directoryField indexOfSelectedItem] | |
| // NSWidowを半透明に(0.0 ~ 1.0) | |
| [_window setAlphaValue:1.0]; | |
| // 背景を設定 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // delegateの取得 | |
| AppDelegate *appDelegate = (AppDelegate*)[[NSApplication sharedApplication] delegate]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSOpenPanel *panel = [NSOpenPanel openPanel]; | |
| [panel setCanChooseFiles:NO]; | |
| [panel setCanChooseDirectories:YES]; | |
| [panel setAllowsMultipleSelection:YES]; // yes if more than one dir is allowed | |
| NSInteger clicked = [panel runModal]; | |
| if (clicked == NSFileHandlingPanelOKButton) { | |
| for (NSURL *url in [panel URLs]) { | |
| // do something with the url here. | |
| NSLog(@"url:%@", [url path]); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSString *errorMsg = @"Are you sure you want to delete this Upload Rule?"; | |
| if(errorMsg.length != 0){ | |
| NSAlert *alert = [ NSAlert alertWithMessageText: @"hoge" | |
| defaultButton: @"OK" // 1 | |
| alternateButton: @"Cancel" // 0 | |
| otherButton: nil // -1 | |
| informativeTextWithFormat: @"%@", errorMsg]; | |
| NSLog(@"%ld",[alert runModal]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Webページを開く | |
| - (IBAction)loadWebPage:(id)sender | |
| { | |
| NSLog(@"load web page"); | |
| NSString *urlAddress = [_urlField stringValue]; | |
| NSURL *url = [NSURL URLWithString:urlAddress]; | |
| NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; | |
| [[_webView mainFrame] loadRequest:requestObj]; | |