Giter VIP home page Giter VIP logo

kaenstc / fwpopupview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from choiceyou/fwpopupview

0.0 2.0 0.0 7.06 MB

弹窗控件:支持AlertView、Sheet、自定义视图的PopupView。AlertView中可以嵌套自定义视图,各组件的显示隐藏可配置;Sheet仿微信样式;同时提供自定义弹出。更多配置请参考”可设置参数“,提供OC使用Demo。

Ruby 4.00% Swift 79.18% C 0.06% Objective-C 16.75%

fwpopupview's Introduction

IOS之弹窗 -- Swift4.x/OC版本(注意:OC版本目前只实现了弹窗基类)

Platform  Language  License

支持pod导入:

pod 'FWPopupView'
注意:如出现 [!] Unable to find a specification for 'FWPopupView' 错误,可执行 pod repo update 命令。

更新记录:

• v2.0.4 :
  1.灰色背景默认值由原来的 alpha=0.6 改为 alpha=0.5;
  2.在原类初始化方法中添加输入框键盘类型参数:UIKeyboardType(鉴于方法可能跟着版本改动,所以建议封装使用);
  
• v2.0.5 :
  1.修复弹窗隐藏时未设置原window为keywindow的问题;
  
• v2.0.6 :
  1.原FWPopupItemHandler改为FWPopupItemClickedBlock,增加反馈当前弹窗参数;
  2.FWItemType加入参数canAutoHide:点击该按钮后会自动隐藏弹窗。这样子做能够适应更多的弹窗场景;
  
• v2.0.7 :
  1.支持单独设置某个按钮的文字、背景颜色;
  
• v3.0.0(大版本) :
  1.弹窗基类重构:设置视图展示位置+偏移量来设置弹窗真正需要展示的位置;有多重可选动画类型。
  2.由于OC类不能继承Swift类,所以弹窗基类实现了两种语言。swift版本:FWPopupView;OC版本:FWPopupBaseView;
  3.FWAlertView/FWSheetView/FWDateView使用基类提供动画类型;
  4.新增FWMenuView,可实现类似QQ/微信首页右上角菜单;
  5.其他细节修改;

简单使用:(注:可下载demo具体查看,分别有OC、Swift的demo)

/// 类初始化方法
///
/// - Parameters:
///   - title: 标题
///   - detail: 描述
///   - confirmBlock: 确定按钮回调
/// - Returns: self
open class func alert(title: String,
                     detail: String,
               confirmBlock: @escaping FWPopupItemHandler) -> FWAlertView
                          
/// 类初始化方法
///
/// - Parameters:
///   - title: 标题
///   - itemTitles: 点击项标题
///   - itemBlock: 点击回调
///   - cancenlBlock: 取消按钮回调
///   - property: FWSheetView的相关属性
/// - Returns: self
open class func sheet(title: String?,
                 itemTitles: [String],
                  itemBlock: @escaping FWPopupItemHandler,
               cancenlBlock: @escaping FWPopupVoidBlock,
                   property: FWSheetViewProperty?) -> FWSheetView

Swift:

let alertView = FWAlertView.alert(title: "标题", detail: "描述描述描述描述") { (index) in
    print("点击了确定")
}
alertView.show()
let sheetView = FWSheetView.sheet(title: "测试", 
                             itemTitles: ["Sheet0", "Sheet1", "Sheet2", "Sheet3"], 
                              itemBlock: { (index) in
    print("Sheet:点击了第\(index)个按钮")
}, cancenlBlock: {
    print("点击了取消")
})
sheetView.show()

OC:

FWAlertView *alertView = [FWAlertView alertWithTitle: @"标题" 
                                              detail: @"描述描述描述描述" 
                                        confirmBlock:^(NSInteger index) {
    NSLog(@"点击了确定");
}];
[alertView show];
FWSheetView *sheetView = [FWSheetView sheetWithTitle: @"标题" 
                                          itemTitles: @[@"Sheet0", @"Sheet1", @"Sheet2", @"Sheet3"] 
                                           itemBlock:^(NSInteger index) {
    NSLog(@"Sheet:点击了第 %ld 个按钮", (long)index);
} cancenlBlock:^{
    NSLog(@"点击了取消");
}];
[sheetView show];

效果:

结尾语:

  • 使用过程中发现bug请issues或(QQ群:670698309);
  • 有新的需求欢迎提出;

fwpopupview's People

Contributors

choiceyou avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.