自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iOS開發(fā):關(guān)于ActionSheet

移動(dòng)開發(fā) iOS
本文介紹了iOS開發(fā)中的關(guān)于ActionSheet的功能與用法,希望本文對(duì)正在學(xué)習(xí)或者是準(zhǔn)備要開始學(xué)習(xí)iOS開發(fā)的同學(xué)起到一些作用。

顯示菜單的方法:

1、showInView

2、showFromToolBar:和showFromTabBar

視圖控制類需要是現(xiàn)實(shí)協(xié)議接口UIActionSheetDelegate

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

主要實(shí)現(xiàn)代碼:

  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. }

類學(xué)習(xí)

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類呈現(xiàn)給用戶一系列交替選項(xiàng)用于決定如何處理所給的任務(wù)。你也可以使用動(dòng)作表來(lái)提示用戶確認(rèn)具有潛在危險(xiǎn)的動(dòng)作。動(dòng)作表包含可選標(biāo)題和1個(gè)或多個(gè)按鈕,每個(gè)按鈕對(duì)應(yīng)響應(yīng)所給的動(dòng)作。

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: 

備注:比對(duì)學(xué)習(xí)下UIAlertView,你會(huì)發(fā)現(xiàn)這兩個(gè)類基本類似

這里還有一組常量值

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.

協(xié)議接口學(xué)習(xí)

UIActionSheetDelegate協(xié)議接口

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: 
責(zé)任編輯:閆佳明 來(lái)源: blog.sina
相關(guān)推薦

2011-05-11 10:02:37

iOS

2015-01-19 12:19:04

iOS源碼ActionSheet仿QQ音樂

2014-03-12 10:13:00

iOSSEL對(duì)象

2011-08-18 11:19:13

IOS開發(fā)Core Plot S

2013-05-02 10:40:24

xcode

2017-11-06 16:00:05

iOS安卓發(fā)送原圖

2011-08-17 14:32:44

iOS開發(fā)繪制

2014-06-10 13:44:58

iOSUIImage知識(shí)點(diǎn)

2011-08-09 16:08:58

IOS游戲Cocos2d

2011-08-16 16:14:07

IOS開發(fā)HTML5通用接口

2018-11-29 13:50:02

APIAPP數(shù)據(jù)集

2011-09-02 19:12:59

IOS應(yīng)用Sqlite數(shù)據(jù)庫(kù)

2015-09-10 09:10:46

2012-07-13 00:03:08

WEB前端開發(fā)WEB開發(fā)

2011-09-08 10:29:27

Windows MobWidget

2011-08-24 14:33:14

LUA開發(fā)環(huán)境Decoda

2011-08-30 16:22:00

MTK開發(fā)環(huán)境

2011-08-01 17:31:25

Xcode開發(fā) Cocoa

2011-07-06 17:40:43

iPhone SDK

2019-07-20 23:30:48

開發(fā)技能代碼
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)