[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];

関連記事

no image

iPhone 3G/3GS用ホルダーケース レイアウト RT-P2LC3 カラビナつき

カバンを持っていないときに、iPhoneをジーパンのポケットに入れておくのはちょっと不安。 なの

記事を読む

no image

iPhone/iPad で教育

この本は面白そう。今後は教育分野での応用も増えていくだろう。 その時に、iPhone/iPad は教

記事を読む

iOS用アイコンをまとめて生成する

しばらく開発してきたアプリがようやくリリースできる状態になってきたので、知り合いのデザイナーと飲み

記事を読む

no image

[iOS SDK] UIDeviceOrientation ではまる

すぐURLが変更されそうだが、2013/02/16 時点だと、Supporting Multiple

記事を読む

AWS IoTを利用してクラウド連携機能を追加してみた

GWに自宅待機でまとまった時間が確保できたので、AWS IoT を利用してMQTTを使った

記事を読む

ドラムちゃんに電子ドラムiWordを接続する

ドラム譜学習アプリ「ドラムちゃん」に、安価なMIDI電子ドラム iWord を接続する方法を説明し

記事を読む

no image

App Store の Kids Category にアプリを公開する その2

Kids Category でアプリを公開してもらうために Submit したところ、見事に Rej

記事を読む

アプリアップデート数はApp Store Connectアプリで確認できる

自作アプリのアップデート数をSafari のApp Store Connectで確認しよう

記事を読む

no image

[iPhone 開発本] Objective-C 逆引きハンドブック

854ページの大著。C&R研究所というところから出版されている。ページはこちら。目次はこちら

記事を読む

[iOS SDK] No identities are available for signing 問題にはまる

久しぶりに Provisioning Profileではまった。 この問題にはまると、解決までにか

記事を読む

Message

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

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

Vision Proアプリ開発本 8/24、8/26に発売

Vision Proアプリ開発入門 P400が 8/24 に発売、V

Developer Strap が日本でも購入可能に

USアカウントでしか購入できなかった Vision Pro 用 De

Vision Pro カバーケースを買ってみた

[itemlink post_id="11629"]

ZEISS Optical Insertsが左右逆で届いている人がいるらしい(自分は大丈夫だった)

Vision Pro はメガネを付けての使用ができないため、

祝Apple Vision Pro 日本発売

昨日 2024/06/28 ついに日本でも Apple Vi

→もっと見る

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