IOS中UIActionSheet使用详解
- (instancetype)initWithTitle:(NSString *)title delegate:(id UIActionSheetDelegate )delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...;
参数说明:
title:视图标题
delegate:设置代理
cancelButtonTitle:取消按钮的标题
destructiveButtonTitle:特殊标记的按钮的标题
otherButtonTitles:其他按钮的标题
二、常用方法和属性介绍@property(nonatomic,copy) NSString *title;
设置标题
@property(nonatomic) UIActionSheetStyle actionSheetStyle;
设置风格,枚举如下:
- (NSInteger)addButtonWithTitle:(NSString *)title;
添加一个按钮,会返回按钮的索引
- (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex;
获取按钮标题
@property(nonatomic,readonly) NSInteger numberOfButtons;
获取按钮数量
@property(nonatomic) NSInteger cancelButtonIndex;
设置取消按钮的索引值
@property(nonatomic) NSInteger destructiveButtonIndex;
设置特殊标记
@property(nonatomic,readonly,getter=isVisible) BOOL visible;
视图当前是否可见
下面是几种弹出方式,会根据风格不同展现不同的方式
- (void)showFromToolbar:(UIToolbar *)view;
- (void)showFromTabBar:(UITabBar *)view;
- (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated ;
- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated ;
- (void)showInView:(UIView *)view;
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated;
使用代码将视图收回
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
点击按钮时触发的方法
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet;
视图将要弹出时触发的方法
- (void)didPresentActionSheet:(UIActionSheet *)actionSheet;
视图已经弹出式触发的方法
- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex;
点击按钮后,视图将要收回时触发的方法
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;
点击按钮后,视图已经收回时触发的方法
iOS - UIActionSheet NS_CLASS_DEPRECATED_IOS(2_0, 8_3, UIActionSheet is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleA...
iOS - UIImagePickerController NS_CLASS_AVAILABLE_IOS(2_0) @interface UIImagePickerController : UINavigationController @available(iOS 2.0, *) public class UIImagePickerController : UINavigationController, NSCoding
iOS - UISegmentedControl NS_CLASS_AVAILABLE_IOS(2_0) @interface UISegmentedControl : UIControl @available(iOS 2.0, *) public class UISegmentedControl : UIControl, NSCoding UISegmentedControl 的 Items 有两种样式,一种是字符串设置的标题样式,一种是图片设置的样式。
iOS - UIToolbar NS_CLASS_AVAILABLE_IOS(2_0) __TVOS_PROHIBITED @interface UIToolbar : UIView @available(iOS 2.0, *) public class UIToolbar : UIView, UIBarPositioning 工具条控件 UIToolbar 用做工具条按钮项(UIBarButtonItem)的容器,可以盛放一个或者多个工具条按钮项,一般放置在界面顶部或者底部。
iOS - UINavigationController NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationController : UIViewController @available(iOS 2.0, *) public class UINavigationController : UIViewController UINavigationController:容器视图控制器的一种,称之为导航视图控制器,导航视图控制器固定高度是 44。
相关文章
- (NO.00003)iOS游戏简单的机器人投射游戏成形记(七)
- Building Plugins for iOS
- iOS 视图控制器转场详解(上)
- iOS中 扫描二维码/生成二维码详解
- iOS开发UI篇—ios应用数据存储方式(归档)
- iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期
- ios手势识别代理
- ios-deploy was not found
- iOS中 HTTP/Socket/TCP/IP通信协议详解 韩俊强的博客
- iOS中 支付宝钱包详解/第三方支付
- iOS中 本地通知/本地通知详解
- iOS中 扫描二维码/生成二维码详解
- iOS中 蓝牙2.0详解/ios蓝牙设备详解
- IOS中使用本地通知为你的APP添加提示用户功能
- 《iPhone与iPad开发实战—iOS经典应用剖析》连载八
- 使用github管理iOS分布式项目开发
- 仿IOS圆形下载进度条
- iOS 改变xib视图的大小
- iOS 自动释放池 @autoreleasepool{}
- Ios开发之 -- js和ios的交互
- iOS使用ffmpeg播放rstp实时监控视频数据流
- IOS基于新浪微博开放平台微博APP