iOS底部弹窗样式

在点.h文件声明

#import <UIKit/UIKit.h>

typedef void(^chooseUploadPopViewSubmitBlock)(NSInteger index);

@interface chooseUploadPopView : UIView

@property (nonatomic, copy) chooseUploadPopViewSubmitBlock chooseUploadPopViewSubmitBlock;

- (void)show;

- (void)hide;

@end

在.m文件去实现

#import "ZXXE_chooseUploadPopView.h"

#import "IdentityScanPopView.h"

#import "CustomButton.h"

#define kConventionCellImageW   32

@interface chooseUploadPopView ()<UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, weak) UIView *contentView;

@property (nonatomic, weak) UILabel *lbInfotitle;

@property (nonatomic, weak) UIImageView *centerimagV;

@property (nonatomic, weak) UIButton *submitBtn;

@property(nonatomic,assign) NSInteger textSize;

@property(nonatomic,assign) CGFloat contentHight;

@property (nonatomic, strong) UITableView *tableView ;

@property (nonatomic, strong) NSArray *dataArr ;

@end

@implementation chooseUploadPopView

- (instancetype)initWithFrame:(CGRect)frame

{

    if (self = [super initWithFrame:frame]) {

        self.textSize = 12;

        self.contentHight = 180;

        self.dataArr =  [NSArray arrayWithObjects:@"拍摄",@"从相册中选择",@"取消", nil];

        [self setUpView];

    }

    return self;

}

- (void)setUpView

{

    self.backgroundColor = [UIColor clearColor];

    self.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H);

    UIView *backGdView = [[UIView alloc] init];

    backGdView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7];

    backGdView.frame = self.bounds;

    [self addSubview:backGdView];

    

    UIView *contentView = [[UIView alloc] init];

    contentView.backgroundColor = [UIColor clearColor];

    contentView.frame = CGRectMake(0, SCREEN_H, SCREEN_W, self.contentHight);

    [self addSubview:contentView];

    self.contentView = contentView;

    

    UIView *toptView = [[UIView alloc] init];

    toptView.backgroundColor = [UIColor clearColor];

    toptView.frame = CGRectMake(0, 0, SCREEN_W,SCREEN_H - self.contentHight);

    [self addSubview:toptView];

    

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)];

       [toptView addGestureRecognizer:tap];

    

    self.tableView  = [[UITableView alloc]initWithFrame:self.frame style:UITableViewStylePlain];

    [self.contentView addSubview:self.tableView];

    self.tableView.dataSource = self;

    self.tableView.delegate = self;

    self.tableView.rowHeight = 60;

    self.tableView.layer.cornerRadius = 20;

    self.tableView.layer.masksToBounds = YES;

    self.tableView.scrollEnabled = NO;

    self.tableView.separatorStyle = UITableViewCellEditingStyleNone;

    

}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return  self.dataArr.count;

}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

//

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

    if (!cell)

    {

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];

    }

    cell.textLabel.text = self.dataArr[indexPath.row];

    cell.textLabel.textAlignment = NSTextAlignmentCenter ;

    cell.textLabel.textColor = [UIColor colorWithHexString:@"#181719"];

    cell.textLabel.font = [UIFont fontWithName:PingFangSC_Regular size:16];

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    

    UIView * linview = [[UIView alloc ]initWithFrame:CGRectMake(0, 59.5, self.width, 0.5)];

    linview.backgroundColor = [UIColor colorWithHexString:@"#EEEEEE"];

    [cell.contentView addSubview:linview];

    return cell;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    //indexPath 该参数中 存着 分区号 和 行号

    NSInteger sectionNum = indexPath.section;

    NSInteger rowNum = indexPath.row;

    [self selectCellnClick:rowNum];

}

#pragma mark -点击事件

- (void)tapClick:(UIGestureRecognizer *)ges

{

    [self hide];

}

- (void)show

{

    self.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H);

    self.contentView.frame = CGRectMake(0, SCREEN_H, SCREEN_W, self.contentHight);

    [[UIApplication sharedApplication].keyWindow addSubview:self];

    [UIView animateWithDuration:0.3 animations:^{

        self.contentView.frame = CGRectMake(0, SCREEN_H - self.contentHight, SCREEN_W, self.contentHight);

    } completion:^(BOOL finished) {

        

    }];

}

- (void)hide

{

    if (self.superview) {

        [UIView animateWithDuration:0.3 animations:^{

            self.contentView.frame = CGRectMake(0, SCREEN_H, SCREEN_W, self.contentHight);

        } completion:^(BOOL finished) {

            [self removeFromSuperview];

        }];

    }

}

#pragma mark -点击事件

- (void)closeBtnClick

{

    [self hide];

}

- (void)selectCellnClick:(NSInteger ) index

{

    [self hide];

    if (self.chooseUploadPopViewSubmitBlock) {

        self.chooseUploadPopViewSubmitBlock(index);

    }

}

@end

调用方式:

导入头文件

#import "ZXXE_chooseUploadPopView.h"

    

 chooseUploadPopView *popV = [[chooseUploadPopView alloc] init];

    __weak typeof(self)weakSelf = self;

    popV.chooseUploadPopViewSubmitBlock = ^(NSInteger index) {

        if (index==0)

        {

//调用

        }

        else if(index==1)

        {

            //调用

        }

        else

        {

        }

    };

    [popV show];

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
iOS软件弹窗dylib库编写是一种在iOS平台上开发和使用动态链接库的方法。动态链接库(Dynamic Library)是一种共享库,可以被多个应用程序同时使用,以提供特定功能或服务。 编写iOS软件弹窗dylib库需要以下步骤: 1. 创建一个新的Xcode项目。选择"Framework & Library"中的"Dynamic Library"模板。 2. 在项目中添加弹窗逻辑的代码,可以使用Objective-C或Swift语言来编写。 3. 将编写的逻辑封装为一个独立的类或函数,并在适当的位置调用。 4. 将编写的代码编译为dylib库,这可以使用Xcode的"Build"功能自动完成。 5. 导出dylib库文件,可以将其复制到其他项目中使用。 使用iOS软件弹窗dylib库的方法是: 1. 在需要使用弹窗功能的iOS应用项目中,导入dylib库文件。可以通过将dylib库文件直接拖拽到Xcode项目中来实现。 2. 在应用程序的源代码中,添加对dylib库的引用和使用。可以使用Objective-C的`dlopen`函数或Swift的`dyld`模块来加载和使用dylib库。 3. 根据dylib库中提供的API,使用需要的弹窗功能。 需要注意的是,dylib库的使用需要满足苹果的开发者政策和审核要求。在使用dylib库时,应确保遵循相关规定,并尽可能保证库文件的安全性和稳定性。 总结来说,iOS软件弹窗dylib库编写是一种在iOS平台上开发和使用独立动态库的方法。需要在Xcode中创建项目、编写弹窗逻辑、编译为dylib库,然后在其他应用项目中导入并使用该库。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

iOS上架APP技术交流

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值