iOS開發基礎 UIActionSheet

2022-04-10 10:18:16 字數 1030 閱讀 6340

uiactionsheet是乙個非常常用的uiview,可以放置多個操作按鈕並通過uiactionsheetdelegate委託實現一些方法。在這裡只是一些基本簡單的應用和講解,以後如果遇到更深層次的應用將會補充上。

例子:可以在乙個訊息中,建立乙個uiactionsheet

uiactionsheet *actt=[[uiactionsheet alloc] initwithtitle: @"title" 

delegate: self

cancelbuttontitle: @"cancel"

destructivebuttontitle: @"imageformalbum"

otherbuttontitles: @"imagefomrcamera",nil];//建立乙個uiactionsheet物件

[actt setactionsheetstyle:uiactionsheetstyleblacktranslucent];//設定actionsheetstyle

[actt release];

通常在使用uiactionsheet過程中需要使用uiactionsheetdelegate委託,一般需要實現- (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex;這個方法。

#pragma mark -

#pragma mark uiactionsheet

- (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex

break;

case 1:

break;

default:

break;

}}

iOS開發基礎

1 乙個應用程式是怎麼啟動的?當我們基於xcode模版建立應用程式時,應用程式啟動時大部分的環境引數會被自動設定。uikit框架提供了乙個應用程式需要構建和管理它的使用者介面的所有類 啟動 結束應用程式,控制介面和觸點事件 uikit是cocoa touch提供的眾多物件導向框架中的乙個。cocoa...

iOS開發基礎 UIButton

今天開始寫ios開發基礎,自己要開始做乙個專案,好用來找第乙份實習工作,開始記錄我學習ios開發的過程。以下是寫在viewcontroller.m檔案下的。viewcontroller.m 01 button created by linjia on 15 8 22.import viewcontr...

iOS開發控制項基礎

一 使用plist檔案 使用plist檔案的目的 將資料和 分離。載入方法 nsstring path nsbundle mainbundle pathforresource imagedata oftype plist nsarray imagelist nsarray arraywithcont...