【UIkit】-8-UIActionSheet - 底部弹出提示,快要被取代

暂无实际内容。

参考
http://my.oschina.net/u/2340880/blog/409907
http://blog.csdn.net/banyingli/article/details/6167561
http://blog.csdn.net/totogo2010/article/details/7618891
http://blog.csdn.net/gf771115/article/details/7741162

UIActionSheet已被弃用iOS中8,改用UIAlertController与UIAlertControllerStyleActionSheet的preferredStyle。

Important: UIActionSheet is deprecated in iOS 8. (Note that UIActionSheetDelegate is also deprecated.) To create and manage action sheets in iOS 8 and later, instead use UIAlertController with a preferredStyle of UIAlertControllerStyleActionSheet. In apps that target versions of iOS prior to iOS 8, use the UIActionSheet class to present the user with a set of alternatives for how to proceed with a given task. You can also use action sheets to prompt the user to confirm a potentially dangerous action. The action sheet contains an optional title and one or more buttons, each of which corresponds to an action to take. Use the properties and methods of this class to configure the action sheet’s message, style, and buttons before presenting it. You should also assign a delegate to your action sheet. Your delegate object is responsible for performing the action associated with any buttons when they are tapped and should conform to the UIActionSheetDelegate protocol. For more information about implementing the methods of the delegate, see UIActionSheetDelegate Protocol Reference. You can present an action sheet from a toolbar, tab bar, button bar item, or from a view. This class takes the starting view and current platform into account when determining how to present the action sheet. For applications running on iPhone and iPod touch devices, the action sheet typically slides up from the bottom of the window that owns the view. For applications running on iPad devices, the action sheet is typically displayed in a popover that is anchored to the starting view in an appropriate way. Taps outside of the popover automatically dismiss the action sheet, as do taps within any custom buttons. You can also dismiss it programmatically. When presenting an action sheet on an iPad, there are times when you should not include a cancel button. If you are presenting just the action sheet, the system displays the action sheet inside a popover without using an animation. Because taps outside the popover dismiss the action sheet without selecting an item, this results in a default way to cancel the sheet. Including a cancel button would therefore only cause confusion. However, if you have an existing popover and are displaying an action sheet on top of other content using an animation, a cancel button is still appropriate. For more information see iOS Human Interface Guidelines.

重要提示:UIActionSheet已被弃用iOS中8(注意UIActionSheetDelegate也过时了。)创建和iOS的8管理行动床单,后来,改用UIAlertController与UIAlertControllerStyleActionSheet的preferredStyle。在面向iOS的前8的iOS版本的应用程序,使用UIActionSheet类与一组为如何进行给定任务的替代品呈现给用户。也可以使用动作表来提示用户确认有潜在危险的动作。动作片包含一个可选的标题和一个或多个按钮,其每一个对应于要采取的动作。使用属性和这个类的方法呈现它之前配置的动作片的消息,风格和按钮。你还应该指定一个委托到你的行动表。你的委托对象是负责执行与任何按钮相关联,当他们挖掘并应符合UIActionSheetDelegate协议的行动。有关实现委托的方法的详细信息,请参阅UIActionSheetDelegate协议参考。您可以从工具栏,标签栏,按钮栏项目,或从视图呈现的动作片。确定如何呈现的动作片,当这个类需要出发视图和当前平台考虑。有关iPhone和iPod touch设备上运行的应用程序时,动作片一般由拥有该视图窗口的底部向上滑动。有关iPad设备运行的应用程序,所述动作片通常显示在被固定在启动视图以适当的方式一个popover。在popover以外的水龙头会自动关闭该动作片,因为在任何自定义按钮做水龙头。您也可以通过编程驳回。当在iPad上呈现一个动作片,还有的时候你不应该包括取消按钮次。如果正在呈现只是动作片,系统会显示一个popover内的动作片,而无需使用一个动画。因为popover以外抽头驳回动作片而不选择一个项目,这将导致一个缺省的方式取消片。包括取消按钮会因此只引起混乱。但是,如果你有一个现有的popover并使用动画显示在其他内容之上的动作片,一个取消按钮仍然是合适的。欲了解更多信息,请参阅iOS的人机界面指南。

 

@protocol UIActionSheetDelegate;

@class UILabel, UIToolbar, UITabBar, UIWindow, UIBarButtonItem, UIPopoverController;

 

typedef NS_ENUM(NSInteger, UIActionSheetStyle) {

UIActionSheetStyleAutomatic        = -1,                     UIActionSheetStyleDefault          = UIBarStyleDefault,

   UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent,

   UIActionSheetStyleBlackOpaque     = UIBarStyleBlackOpaque,

};

 

NS_CLASS_AVAILABLE_IOS(2_0)

@interface UIActionSheet : UIView

 

- (instancetype)initWithTitle:(NSString *)title delegate:(id<UIActionSheetDelegate>)delegatecancelButtonTitle:(NSString*)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION NS_EXTENSION_UNAVAILABLE_IOS("Use UIAlertController instead.");

 

@property(nonatomic,assign) id<UIActionSheetDelegate> delegate;   

@property(nonatomic,copy) NSString *title;

@property(nonatomic) UIActionSheetStyleactionSheetStyle;

 

- (NSInteger)addButtonWithTitle:(NSString *)title;   

- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;

@property(nonatomic,readonly) NSInteger numberOfButtons;

@property(nonatomic) NSInteger cancelButtonIndex;      

@property(nonatomic) NSInteger destructiveButtonIndex;  

@property(nonatomic,readonly) NSInteger firstOtherButtonIndex;

@property(nonatomic,readonly,getter=isVisible) BOOL visible;

 

- (void)showFromToolbar:(UIToolbar *)view;

- (void)showFromTabBar:(UITabBar *)view;

- (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated NS_AVAILABLE_IOS(3_2);

- (void)showFromRect:(CGRect)rect inView:(UIView *)viewanimated:(BOOL)animated NS_AVAILABLE_IOS(3_2);

- (void)showInView:(UIView *)view;

- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;

@end

 

@protocol UIActionSheetDelegate <NSObject>

@optional

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;

- (void)actionSheetCancel:(UIActionSheet *)actionSheet;

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet;

- (void)didPresentActionSheet:(UIActionSheet *)actionSheet; 

- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex;

- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;

@end

 




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值