這篇文章主要介紹iOS中如何實(shí)現(xiàn)UIActionSheet動(dòng)態(tài)添加按鈕,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)建站自2013年創(chuàng)立以來,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)制作、網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元雁塔做網(wǎng)站,已為上家服務(wù),為雁塔各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575
一,效果圖。
二,代碼。
RootViewController.h
#import <UIKit/UIKit.h> @interface RootViewController : UIViewController <UIActionSheetDelegate> @end
RootViewController.m
//點(diǎn)擊任何處,彈出UIActionSheet -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UIActionSheet *sheet=[[UIActionSheet alloc]initWithTitle:@"標(biāo)題" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; // 逐個(gè)添加按鈕(比如可以是數(shù)組循環(huán)) [sheet addButtonWithTitle:@"Item A"]; [sheet addButtonWithTitle:@"Item B"]; [sheet addButtonWithTitle:@"Item C"]; // 同時(shí)添加一個(gè)取消按鈕 [sheet addButtonWithTitle:@"Cancel"]; sheet.cancelButtonIndex = sheet.numberOfButtons-1; [sheet showInView:self.view]; }
以上是“iOS中如何實(shí)現(xiàn)UIActionSheet動(dòng)態(tài)添加按鈕”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
當(dāng)前標(biāo)題:iOS中如何實(shí)現(xiàn)UIActionSheet動(dòng)態(tài)添加按鈕
網(wǎng)站路徑:http://vcdvsql.cn/article46/gghohg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、ChatGPT、網(wǎng)站導(dǎo)航、定制開發(fā)、靜態(tài)網(wǎng)站、網(wǎng)站改版
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
移動(dòng)網(wǎng)站建設(shè)知識(shí)