iOS学习之UIActionSheet的使用
UIActionSheet是在iOS弹出的选择按钮项,可以添加多项,并为每项添加点击事件。 为了快速完成这例子,我们打开Xcode 4.3.2, 先建立一个single view application。然后再xib文件添加一个button,用来弹出sheet view。 1、首先在.h文件中实现协议 加代码的地方在@interface那行的最后添加<UIActionSheetDelegate>,协议相当于java里的接口,实现协议里的方法。 [cpp] view plain copy @interfacesheetviewViewController:UIViewController<UIActionSheetDelegate> @end 2、添加button,命名button为showSheetView. 3、为button建立Action映射,映射到.h文件上,事件类型为Action ,命名为showSheet。 4、在.m文件上添加点击事件代码 图的效果是这样的: [cpp] view plain copy -(IBAction)showSheet...