[iOS SDK] QuickDialog を使ってみた

公開日: : 最終更新日:2013/09/09 iPad, iPhone

[IOS] iOS オープンソースライブラリ徹底活用 菊田剛著 秀和システム | DevCafeJp で紹介されていた、QuickDialog – ESCOZ Inc を利用してみた。

これを利用すると設定画面作成作業がかなり楽になるのでとても助かる。
ドキュメントはあまりないので、サンプルプログラムを動かしてみて理解していくのが良さそう。
QuickDialog は ARC をサポートしている。

まだ検索してみてもあまりサンプルコードが見つからないので、参考までに今回使ったコードを切り出してみた。
これはTableViewから1つを選択するタイプのダイアログ。

Quick1使い方がこれで正しいかは不明だが、動いてはいる。

QRootElement* root = [[QRootElement alloc] init];
root.grouped = YES;
root.title = NSLocalizedString(@"Separate String", @"Separate String");

QSelectSection *simpleSelectSection =
[[QSelectSection alloc] initWithItems:nameArray selectedIndexes:nil title:NSLocalizedString(@"Select a separate string", @"Select a separate string")];
simpleSelectSection.onSelected = ^{
NSNumber *selected = [simpleSelectSection.selectedIndexes objectAtIndex:0];
};
[root addSection:simpleSelectSection];

QSection *btnSection = [[QSection alloc]initWithTitle:nil];
[root addSection:btnSection];

QButtonElement *okBtn = [[QButtonElement alloc]initWithTitle:@"OK"];
okBtn.onSelected = ^{
[self dismissViewControllerAnimated:YES completion:^{
[self.tableView reloadData];
}];
};
[btnSection addElement:okBtn];

QuickDialogController *qc = [[QuickDialogController alloc]initWithRoot:root];
[self presentViewController:qc animated:YES completion:^{
//
}];

こちらはラベルを複数表示するタイプのダイアログ。

Quick2

QRootElement* root = [[QRootElement alloc] init];
root.grouped = YES;
root.title = nil;

QSection* detailsSection = [[QSection alloc] initWithTitle:NSLocalizedString(@"About", @"About")];
[root addSection:detailsSection];

NSString *str1 = NSLocalizedString(@"Support Site", @"Supoprt Site");
NSString *str2 = NSLocalizedString(@"Twitter", @"Twitter");

QLabelElement *label1 = [[QLabelElement alloc]initWithTitle:str1 Value:nil];
label1.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
label1.onSelected = ^{
NSString *str = NSLocalizedString(@"https://tokentoken.com/blog/support-e/", @"SupportSiteURL");

NSURL *target = [[NSURL alloc] initWithString:str];
[[UIApplication sharedApplication] openURL:target];
};

[detailsSection addElement:label1];

QLabelElement *label2 = [[QLabelElement alloc]initWithTitle:str2 Value:nil];
label2.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
label2.onSelected = ^{
NSString *str = NSLocalizedString(@"http://www.twitter.com/onpuchan_app/", @"TwitterURL");

NSURL *target = [[NSURL alloc] initWithString:str];
[[UIApplication sharedApplication] openURL:target];
};
[detailsSection addElement:label2];

QSection *btnSection = [[QSection alloc]initWithTitle:nil];
[root addSection:btnSection];

QButtonElement *okBtn = [[QButtonElement alloc]initWithTitle:@"OK"];
okBtn.onSelected = ^{
[self dismissViewControllerAnimated:YES completion:^{
//
}];
};
[btnSection addElement:okBtn];

QuickDialogController *qc = [[QuickDialogController alloc]initWithRoot:root];
[self presentViewController:qc animated:YES completion:^{
//
}];

iOS は便利なライブラリがどんどん出てくるので作りたいものに集中できるのはありがたいこと。

追記 2013/09/09

QuickDialog には、QuickDialog内部で使っている便利クラスが存在する。
例えばその中の QWebViewController はリロードボタンや戻る・進むボタンが用意されたViewControllerで、url を渡すだけでWebページを表示してくれる。
ちょっとWebを表示したいだけなので手をかけずに実現したい、という時には便利そう。

    QWebViewController *webC = [[QWebViewController alloc]initWithUrl:url];
    [self.navigationController pushViewController:webC animated:YES];
    [webC release];

関連記事

iPad 発売 2010/04/03

日本時間4/3 17:00あたりに、Appleから iPad is here. メールが来てい

記事を読む

no image

[iPhone SDK] iAd 組み込みでひっかかったこと

iAd は iAd Programming Guide を読んだりすればとても簡単にアプリへの組み込

記事を読む

コードちゃん 1.0.3 アップデート

コード学習アプリ コードちゃん 1.0.3をアップデートしました。ダイアトニックコードの Bmb5

記事を読む

おんぷちゃん for iPad リアル鍵盤で回答

おんぷちゃん for iPad は五線譜上に表示される音符をスクリーン上のキーボードや、USBやB

記事を読む

no image

unite スマートベース SmartBase for iPhone

しばらく前に買って愛用していて、今回もう1台買ったので紹介。iPhone 3G/3GS用と、

記事を読む

no image

有料iPhoneアプリを売る手続き

AppStoreで無料アプリを配布している分には必要ない手続きだが、有料アプリを売ろうと思うといろい

記事を読む

LogLocations 1.3.4 リリース

久しぶりに、LogLocations をアップデートしました。今までピンを置いていた画面に、時刻を表

記事を読む

no image

iPhoneゲーム開発ワークショップ 翔泳社 PJ Cabrera

以前紹介した、iPhone Games Projects の翻訳本「iPhoneゲーム開発ワークショ

記事を読む

no image

[iPhone開発本][洋書] iPhone 3D Programming

たまたまApp Storeで O'reilly Media で検索したら、600円の本がわんさか表示

記事を読む

no image

Corona SDK 調査4日目

今日はスクリプト言語による効率的ゲーム開発を読んで、ちょっとテストプログラムを書いたくらいであまり進

記事を読む

Message

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

no image
DELL 31.5インチディスプレイ U3223QE 購入

これまで M1 MacBook Air の外部ディスプレイとして、

WWDC 2023 Vision Pro発表

2023/6/5 (日本時間 2023/06/06 2AM)のWWD

M1 MacBook Air を Venturaにアップデートする

M1 MacBook Air を macOS Montere

iOS16でaurioTouch の inBufferFramesが1になる

https://developer.apple.com/librar

おんぷちゃん for iPad 2.0.0リリース

あけましておめでとうございます。今年もよろしくお願いします。

→もっと見る

  • 2013年2月
     123
    45678910
    11121314151617
    18192021222324
    25262728  
PAGE TOP ↑