iOS.UIKit.07.UIAlertView_UIActionSheet

一、案例介绍:点击第一个按钮弹出提示框;点击第二个按钮弹出操作表。如图01,图02,图03

图01图02图03

二、案例步骤:

1、选择Simple View Aplication,取名cq.32.警告框和操作表,如图04

2、Main.storyboard

3、CQ32ViewController.h


#import <UIKit/UIKit.h>

@interface CQ32ViewController : UIViewController<UIAlertViewDelegate,UIActionSheetDelegate>

- (IBAction)testAlertView:(id)sender;
- (IBAction)testActionSheet:(id)sender;

@end

4、CQ32ViewController.m


- (IBAction)testAlertView:(id)sender
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert text goes here" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alertView show];
}
#pragma mark -- 实现UIAlertViewDelegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"buttonIndex = %i",buttonIndex);
}

- (IBAction)testActionSheet:(id)sender
{
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"破坏性按钮" otherButtonTitles:@"新浪微博", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"buttonIndex = %i",buttonIndex);
}

iOS.UIKit.07.UIAlertView_UIActionSheet,布布扣,bubuko.com

时间: 2024-12-13 14:55:26

iOS.UIKit.07.UIAlertView_UIActionSheet的相关文章

iOS.UIKit.11.UIPickerView

一.案例介绍:点击UIButton,将选中的省市信息显示在UILabel中,如图01,02 图01图02 二.案例步骤: 1.选择Simple View Aplication,取名cq.37.普通选择器,如图03 图03 2.Main.storyboard,如图04 3.provinces_cities.plist 4.CQ37ViewController.h #import <UIKit/UIKit.h> @interface CQ37ViewController : UIViewContr

iOS.UIKit.12.UICollectionView

一.案例介绍:以集合形式展现图片,如图01 图01 二.案例步骤: 1.选择Simple View Aplication,取名cq.38.集合视图,如图02 图02 2.Main.storyboard,如图03 图03 3.events.plist,如图04,05 4.CQ38ViewController.h #import <UIKit/UIKit.h> @interface CQ38ViewController : UICollectionViewController @property

iOS.UIKit.09.UINavigationBar

一.点击UINavigationBar中的UIBarButtonItem,改变UILabel中的文本,如图01,02,03 图01图02图03 二.项目步骤: 1.选择Simple View Aplication,取名cq.40.UINavigationBar,如图04 图04 2.Main.storyboard,如图05 3.CQ40ViewController.h #import <UIKit/UIKit.h> @interface CQ40ViewController : UIViewC

iOS.UIKit.08.UIToolbar

一.案例介绍:点击UIToolbar中的UIBarButtonItem,改变UILabel中的文本,如图01,02,03 图01图02图03 二.案例步骤: 1.选择Simple View Aplication,取名cq.33.工具栏和导航栏,如图04 2.Maim.storyboard,如图05 3.CQ33ViewController.h #import <UIKit/UIKit.h> @interface CQ33ViewController : UIViewController @pr

iOS.UIKit.10.UIDatePicker

一.案例介绍:点击屏幕中的UIButton,将在UIDatePicker选择的日期显示在UILabel中,如图01,02 图01图02 二.案例步骤: 1.选择Simple View Aplication,取名cq.36.日期选择器,如图03 图03 2.Main.storyboard,如图04 3.CQ36ViewController.h #import <UIKit/UIKit.h> @interface CQ36ViewController : UIViewController @pro

iOS.UIKit.06.UIProgressView_UIActivityIndicatorView

一.案例介绍:点击按钮upload,活动指示器转动,再次点击停止转动:点击download按钮进度条加载满后提示,如图01,图02. 图01图02 二.案例步骤: 1.选择Simple View Aplication,取名cq.31.活动指示器和进度条,如图03. 图03 2.Main.storyboard,如图04,图05. 图04图05 3.CQ31ViewController.h #import <UIKit/UIKit.h> @interface CQ31ViewController

iOS UIKit:viewController之动画(5)

当弹出一个view controller时,UIKit提供了一些标准转换动画,并且也支持用户自定义的动画效果. 1 UIView动画 UIView是自带动画实现功能,其中有两种方式实现:        1) animateWithDuration系列方法        2) transitionFromViewController方法 1.1 animateWithDuration 只要在该方法的animations block中修改UIView的动画属性,那么即可实现动画变换,所以为conta

iOS.UIKit.05.UIScrollView

一.案例介绍:利用UIScrollView, 避免键盘遮挡控件:图01.图02其实是存在第三个UIButton的,滑动屏幕可以看到,如图06.效果如图01,图02. 图01图02图03图06 二.案例步骤: 1.选择Single View Application新建项目,取名cq.30.ScrollView,如图03. 2.Main.storyboard如图04,图05. 图04图05 3.CQ30ViewController.h #import <UIKit/UIKit.h> @interf

iOS.UIKit.02.UIButton_UILabel

图01图02 图03 一.案例介绍:点击"图01"中的Button,Label文本变为"Hello World",如"图02". 二.案例步骤: 1.选择Single View Application新建项目,取名cq.39.UIButton_UILabel,如"图03". iOS.UIKit.02.UIButton_UILabel,布布扣,bubuko.com