iOS DropDown下拉按鈕效果代碼分享
更新時間:2017年04月10日 11:23:03 作者:弦外雨
這篇文章主要為大家詳細介紹了iOS DropDown下拉按鈕效果的實現(xiàn)代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了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];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- 舉例講解iOS中延遲加載和上拉刷新/下拉加載的實現(xiàn)
- iOS開發(fā)中視圖的下拉放大和上拉模糊的效果實現(xiàn)
- iOS實現(xiàn)頂部標簽式導(dǎo)航欄及下拉分類菜單
- iOS編寫下拉刷新控件
- 一個方法搞定iOS下拉放大及上推縮小
- iOS開發(fā)之tableView點擊下拉擴展與內(nèi)嵌collectionView上傳圖片效果
- iOS開發(fā)之UITableView與UISearchController實現(xiàn)搜索及上拉加載,下拉刷新實例代碼
- IOS代碼筆記之下拉菜單效果
- iOS實現(xiàn)MJRefresh下拉刷新(上拉加載)使用詳解
- iOS下拉選擇菜單簡單封裝
相關(guān)文章
IOS 播放系統(tǒng)提示音使用總結(jié)(AudioToolbox)
這篇文章主要介紹了IOS 播放系統(tǒng)提示音使用總結(jié)(AudioToolbox)的相關(guān)資料,需要的朋友可以參考下2017-05-05
Ios蘋果app應(yīng)用程序開發(fā)者如何獲取IPA簽名證書詳解
這篇文章主要為大家介紹了Ios蘋果app應(yīng)用程序開發(fā)者如何獲取IPA簽名證書詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-11-11

