国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > iOS > 正文

IOS代碼筆記之下拉菜單效果

2020-07-26 03:18:55
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

本文實(shí)例為大家分享了ios下拉菜單的具體代碼,供大家參考,具體內(nèi)容如下

一、效果圖

二、工程圖

三、代碼

RootViewController.h

#import <UIKit/UIKit.h>@interface RootViewController : UIViewController@end 
 

RootViewController.m

#import "RootViewController.h"#import "NIDropDown.h"@interface RootViewController ()@end@implementation RootViewController- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self;}- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view.  self.title=@"DropDown";  UIButton *button=[UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame=CGRectMake(10, 100, 150,30); button.backgroundColor=[UIColor redColor]; [button addTarget:self action:@selector(doClickAction:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:button];    }-(void)doClickAction:(UIButton *)btn{ NSArray *dataArray=[NSArray arrayWithObjects:@"1",@"2",@"3",@"4",@"5", nil];  NIDropDown *dropDown=[[NIDropDown alloc]init]; [dropDown showDropDown:btn andHeight:[dataArray count]*36 andData:dataArray]; [self.view addSubview:dropDown];}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 安泽县| 乌拉特中旗| 喀什市| 常宁市| 湟源县| 阳朔县| 松溪县| 同德县| 新密市| 普兰县| 阿拉尔市| 岳阳县| 中卫市| 乌什县| 芒康县| 都安| 西贡区| 陆良县| 榆中县| 临洮县| 黄山市| 迁西县| 麻栗坡县| 灵台县| 沅江市| 石嘴山市| 安徽省| 榆林市| 建德市| 香河县| 夏津县| 虎林市| 临清市| 枞阳县| 东宁县| 普安县| 新巴尔虎右旗| 塘沽区| 安平县| 乐东| 江山市|