成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

iOS開發:關于ActionSheet

移動開發 iOS
本文介紹了iOS開發中的關于ActionSheet的功能與用法,希望本文對正在學習或者是準備要開始學習iOS開發的同學起到一些作用。

顯示菜單的方法:

1、showInView

2、showFromToolBar:和showFromTabBar

視圖控制類需要是現實協議接口UIActionSheetDelegate

  1. @interface HelloController :UIViewController<UIActionSheetDelegate> 
  2. @end 

主要實現代碼:

  1. - (void)actionSheet:(UIActionSheet*)actionSheetclickedButtonAtIndex:(NSInteger)buttonIndex 
  2. printf("User Pressed Button %d\n",buttonIndex + 1); 
  3. [actionSheet release]; 
  4. - (void) presentSheet 
  5. UIActionSheet *menu = [[UIActionSheetalloc] 
  6. initWithTitle: @"FileManagement" 
  7. delegate:self 
  8. cancelButtonTitle:@"Cancel" 
  9. destructiveButtonTitle:@"DeleteFile" 
  10. otherButtonTitles:@"Rename File", @"EmailFile", nil]; 
  11. [menu showInView:self.view]; 
  12. }

類學習

UIActionSheet類

繼承UIView

Use the UIActionSheet class to presentthe user with a set of alternatives for how to proceed with a giventask. You can also use action sheets to prompt the user to confirma potentially dangerous action. The action sheet contains anoptional title and one or more buttons, each of which correspondsto an action to take. 

使用UIActionSheet類呈現給用戶一系列交替選項用于決定如何處理所給的任務。你也可以使用動作表來提示用戶確認具有潛在危險的動作。動作表包含可選標題和1個或多個按鈕,每個按鈕對應響應所給的動作。

Creating Action Sheets

  1. –initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles: 

Setting Properties

  1. delegate  property 
  2. title  property 
  3. visible  property 
  4. actionSheetStyle property 

Configuring Buttons

  1. –addButtonWithTitle: 
  2. numberOfButtons property 
  3. –buttonTitleAtIndex: 
  4. cancelButtonIndex property 
  5. destructiveButtonIndex property 
  6. firstOtherButtonIndex property 

Presenting the Action Sheet

  1. –showFromTabBar: 
  2. –showFromToolbar: 
  3. –showInView: 
  4. –showFromBarButtonItem:animated: 
  5. –showFromRect:inView:animated: 

Dismissing the Action Sheet

  1. –dismissWithClickedButtonIndex:animated: 

備注:比對學習下UIAlertView,你會發現這兩個類基本類似

這里還有一組常量值

UIActionSheetStyle

Specifies the style of an actionsheet.

  1. typedef enum { 
  2. UIActionSheetStyleAutomatic  =-1, 
  3. UIActionSheetStyleDefault  = UIBarStyleDefault, 
  4. UIActionSheetStyleBlackTranslucent =UIBarStyleBlackTranslucent, 
  5. UIActionSheetStyleBlackOpaque  =UIBarStyleBlackOpaque, 
  6. } UIActionSheetStyle; 

Constants

UIActionSheetStyleAutomatic

Takes the appearance of the bottom bar if specified; otherwise,same as UIActionSheetStyleDefault.

UIActionSheetStyleDefault

 Thedefault style.

UIActionSheetStyleBlackTranslucent

 Ablack translucent style.

UIActionSheetStyleBlackOpaque

 Ablack opaque style.

協議接口學習

UIActionSheetDelegate協議接口

The UIActionSheetDelegate protocoldefines the methods a delegate of a UIActionSheet object shouldimplement. The delegate implements the button actions and any othercustom behavior. Some of the methods defined in this protocol areoptional.

Responding to Actions

  1. –actionSheet:clickedButtonAtIndex: 

Customizing Behavior

  1. –willPresentActionSheet: 
  2. –didPresentActionSheet: 
  3. –actionSheet:willDismissWithButtonIndex: 
  4. –actionSheet:didDismissWithButtonIndex: 

Canceling

  1. –actionSheetCancel: 
責任編輯:閆佳明 來源: blog.sina
相關推薦

2011-05-11 10:02:37

iOS

2015-01-19 12:19:04

iOS源碼ActionSheet仿QQ音樂

2014-03-12 10:13:00

iOSSEL對象

2011-08-18 11:19:13

IOS開發Core Plot S

2013-05-02 10:40:24

xcode

2017-11-06 16:00:05

iOS安卓發送原圖

2011-08-17 14:32:44

iOS開發繪制

2014-06-10 13:44:58

iOSUIImage知識點

2011-08-09 16:08:58

IOS游戲Cocos2d

2011-08-16 16:14:07

IOS開發HTML5通用接口

2018-11-29 13:50:02

APIAPP數據集

2011-08-01 17:31:25

Xcode開發 Cocoa

2011-08-24 14:33:14

LUA開發環境Decoda

2011-09-08 10:29:27

Windows MobWidget

2012-07-13 00:03:08

WEB前端開發WEB開發

2011-08-30 16:22:00

MTK開發環境

2011-07-06 17:40:43

iPhone SDK

2011-07-19 15:33:57

iPhone

2011-08-18 10:39:46

iPhone開發界面

2012-03-20 21:21:59

開發
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 成人国产一区二区三区精品麻豆 | 日本欧美在线观看视频 | 精品产国自在拍 | 国产香蕉视频 | 日本久久精 | 国产成人免费在线 | 密室大逃脱第六季大神版在线观看 | 国产精品一区二 | 一区二区三区欧美在线观看 | 成人二区 | 国产午夜在线 | 日本aⅴ中文字幕 | 久久久久国产一区二区三区 | 盗摄精品av一区二区三区 | 亚洲a网 | 蜜桃免费一区二区三区 | 久久中文字幕一区 | 亚洲精品国产成人 | 欧美日韩中文字幕在线 | 国产精品久久久久久久岛一牛影视 | 日韩欧美一区二区三区免费观看 | 操视频网站 | 久久精品亚洲精品国产欧美 | 国产精品大片在线观看 | 日韩精品一区二区三区在线播放 | 日韩成人在线电影 | 久久久久久久久淑女av国产精品 | 中文一区 | 国产精品久久久久久久久免费相片 | 欧美在线a | 天天综合91 | 久久久久九九九女人毛片 | 九九热在线视频观看这里只有精品 | 91在线免费视频 | 国产一区二区三区在线看 | 久久久精品高清 | 国产精品a久久久久 | 亚洲九九色 | 国产精品一二三区 | 天堂一区二区三区 | 国产精品伦一区二区三级视频 |