変なタイトルだが。。こんな感じでblocksで書ける(デモコードから引用)。
- (IBAction)showAlert:(id)sender
{
BlockAlertView *alert = [BlockAlertView
alertWithTitle:@"Alert Title"
message:@"This is a very long message, ..."];
[alert setCancelButtonWithTitle:@"Cancel" block:nil];
[alert setDestructiveButtonWithTitle:@"Kill!" block:nil];
[alert addButtonWithTitle:@"Show Action Sheet on top" block:^{
[self showActionSheet:nil];
}];
[alert addButtonWithTitle:@"Show another alert" block:^{
[self showAlert:nil];
}];
[alert show];
}ボタン押下のハンドラはブロックとして追記していける。デリゲートいらずで便利。さらに見た目も悪くなく特にアニメーションがいい。アラートビューは上から降りてきて少しバウンス、アクションシートは下からせり上がってきて少しバウンス。ちょっとしたことだけどこういう効果は重要。
ライセンス:不明
関連記事




