2009年10月23日

UIActionSheetでキャンセルが効かないときの回避コード

UIActionSheetでは、キャンセルボタンを含めるのが通常のUIだが、キャンセルボタンが効く場合と効かない場合がある。これはSDKのバグらしいのでコードで回避することができる。



変更前
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
initWithTitle: @"どちらで開きますか?"
delegate: self
cancelButtonTitle: NSLocalizedString(@"キャンセル", nil)
destructiveButtonTitle: nil
otherButtonTitles:
@"アプリ内で開く",
@"Safariで開く", nil]
autorelease];
[actionSheet showInView: self.view];


変更後
UIActionSheet *actionSheet = [[[UIActionSheet alloc]
initWithTitle: @"どちらで開きますか?"
delegate: self
cancelButtonTitle: NSLocalizedString(@"キャンセル", nil)
destructiveButtonTitle: nil
otherButtonTitles:
@"アプリ内で開く",
@"Safariで開く", nil]
autorelease];
[actionSheet showInView: self.view.window];



[actionSheet showInView: self.view];

[actionSheet showInView: self.view.window];
に変更する。


参考記事:
http://freeek.jp/blog/iphone/139/
 

ラベル:iPhone
posted by mobileDeveloper at 15:37 | Comment(0) | TrackBack(0) | UIActionSheet | このブログの読者になる | 更新情報をチェックする
この記事へのコメント
コメントを書く
お名前:

メールアドレス:

ホームページアドレス:

コメント:

認証コード: [必須入力]


※画像の中の文字を半角で入力してください。
※ブログオーナーが承認したコメントのみ表示されます。

この記事へのトラックバック