IOS开发中代码注释的下拉效果
来源:爱站网时间:2021-02-09编辑:网友分享
很多试图的下拉都是直接加载到tableview或collectionview中进行的,而只要我们能拉下来,效果会变得不同,本文是爱站技术频道小编带来的IOS开发中代码注释的下拉效果,感兴趣的小伙伴们一起参考看看吧!
很多试图的下拉都是直接加载到tableview或collectionview中进行的,而只要我们能拉下来,效果会变得不同,本文是爱站技术频道小编带来的IOS开发中代码注释的下拉效果,感兴趣的小伙伴们一起参考看看吧!
一、效果图


二、工程图

三、代码
RootViewController.h
#import@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];
}
相信大家通过爱站技术频道介绍的IOS开发中代码注释的下拉效果,都了解了非常多,总之,大家喜欢我们分享的知识,就继续关注js.aizhan.com吧!
下一篇:IOS开发之代码注释的滑动效果
