他のメニューボタンを使ってこの種類のメニューを作成したいと思います。それを表すデフォルトのViewControllerはありますか?または画像を取得してこれを自分で作成する必要がありますか?UIActionSheetの作成
答えて
UIActionSheetのドキュメントを見てみましょう。
NSString *actionSheetTitle = @"Action Sheet Demo"; //Action Sheet Title
NSString *destructiveTitle = @"Destructive Button"; //Action Sheet Button Titles
NSString *other1 = @"Other Button 1";
NSString *other2 = @"Other Button 2";
NSString *other3 = @"Other Button 3";
NSString *cancelTitle = @"Cancel Button";
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:actionSheetTitle
delegate:self
cancelButtonTitle:cancelTitle
destructiveButtonTitle:destructiveTitle
otherButtonTitles:other1, other2, other3, nil];
[actionSheet showInView:self.view];
あなたが探しているものは、アクションシートと呼ばれます。その詳細はこちらhttp://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html
UIActionSheet
を使用する必要があります。
まず、UIActionSheetDelegate
をViewController.hファイルに追加する必要があります。そして、あなたは通話のそれぞれを処理する必要が
UIActionSheet *popup = [[UIActionSheet alloc] initWithTitle:@"Select Sharing option:" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:
@"Share on Facebook",
@"Share on Twitter",
@"Share via E-mail",
@"Save to Camera Roll",
@"Rate this App",
nil];
popup.tag = 1;
[popup showInView:self.view];
:
次にあなたがactionsheetを参照することができます。
- (void)actionSheet:(UIActionSheet *)popup clickedButtonAtIndex:(NSInteger)buttonIndex {
switch (popup.tag) {
case 1: {
switch (buttonIndex) {
case 0:
[self FBShare];
break;
case 1:
[self TwitterShare];
break;
case 2:
[self emailContent];
break;
case 3:
[self saveContent];
break;
case 4:
[self rateAppYes];
break;
default:
break;
}
break;
}
default:
break;
}
}
これは、それがUIActionSheetと呼ばれたiOS 8.xの https://developer.apple.com/documentation/uikit/uialertcontroller#//apple_ref/occ/cl/UIAlertController
+! (それは良い答えを提供するだけでなく) 'UIActionSheet'と呼んでいる唯一の人だからです。 – rmaddy
私は質問を見て、文字通り私のアプリで作業していた!それは私のコードに由来しています;) – ApolloSoftware
それはまた、UIActionSheetDelegateを追加せずに動作しています..私はどのように知って... – Nepster
のために廃止されました:あなたはそうのようなものを作成します。
NSString *actionSheetTitle = @"Action Sheet Demo"; //Action Sheet Title
NSString *destructiveTitle = @"Destructive Button"; //Action Sheet Button Titles
NSString *other1 = @"Other Button 1";
NSString *other2 = @"Other Button 2";
NSString *other3 = @"Other Button 3";
NSString *cancelTitle = @"Cancel Button";
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:actionSheetTitle
delegate:self
cancelButtonTitle:cancelTitle
destructiveButtonTitle:destructiveTitle
otherButtonTitles:other1, other2, other3, nil];
[actionSheet showInView:self.view];
をボタンアクションに応答するUISctionSheetDelegateを実装します。この質問のタイトルと人気が重複したよりもはるかに優れています
- 1. 緑色のUIActionSheetボタンを作成しますか?
- 2. UIActionSheet buttonIndex
- 3. UIActionSheetカスタマイズ
- 4. UIActionSheetボタンの色
- 5. iPadのUIActionSheetのキャンセルボタン
- 6. UIActionSheet内の[Undo]ボタン
- 7. メインビューaにUIActionsheet
- 8. UIActionSheet cancelButtonTitle ipad
- 9. UIActionSheet UI仕様
- 10. UIActionSheetとUIView
- 11. Android:iOS UIActionSheet相当
- 12. UIActionSheetを表示
- 13. UIActionSheet showFromRectオートローテーション
- 14. UIActionSheetの終了後にUIActionSheet項目を表示する方法
- 15. iPadのShareKitのUIActionsheet問題
- 16. TabBarControllerのUIActionSheet内のUIPIckerView
- 17. UIPickerViewのUIActionSheetと前のボタン
- 18. UIActionSheetの破壊ボタンのガイドライン
- 19. 通知センターとUIActionSheet
- 20. UIActionSheet奇妙なアニメーション?
- 21. UIActionSheetロングリストの動作が4.2で変更されましたか?
- 22. UIActionsheetの中でUITextFieldsを操作するには?
- 23. iPad UIActionSheetを外側にタップすると、UIActionSheetの状態になりますか?
- 24. UIActionSheetからUIPopoverControllerにアクセス
- 25. イメージをUIActionSheetに追加
- 26. UIACtionSheet代議員質問
- 27. UIActionSheetボタンは、新しいビュー
- 28. UIActionSheetでUIAlertViewを表示
- 29. フレームをUIActionSheetに設定
- 30. AppDelegateのUIActionSheetを解除する
(コードはこのチュートリアルからです)http://mobile.tutsplus.com/tutorials/iphone/uiactionsheet_uiactionsheetdelegate:
は、詳細は、このチュートリアルを見てみましょう。この質問を再開して、更新された回答を追加できるようにするとよいでしょう。 – Suragch
投票を再開してください。 – Stunner
@Suragchあなたは正しいです。他のリンクよりも助かりました。 –