Latest 1.0.5
Homepage https://github.com/yscode001/YSModal_topToBom
License MIT
Platforms ios 9.0
Dependencies YSBase
Frameworks UIKit
Authors

模态弹框(从上往下),自定义高度,顶部与屏幕对齐,底部为半透明

YSModal_topToBom

环境

swift4.2、iOS9.0

使用步骤

1、导入框架

pod 'YSModal_topToBom'

2、导入命名空间

import YSModal_topToBom

使用小技巧

PresentedViewController 使用说明和示例

1、PresentedViewController只需要继承YSModalTopToBom_presentedVC即可;

如果是UINavigationController,继承YSModalTopToBom_presentedNavC,无法用差异;

2、如果需要自定义高度和遮罩颜色及透明度,实现相应的方法即可;

import UIKit

class PresentedVC: YSModalTopToBom_presentedVC {

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.orange
    }

    // 如果不实现此方法,默认为屏幕高度
    override func ys_setupModalHeight() -> CGFloat {
        return 300
    }

    // 如果不实现方法,遮罩视图默认透明色UIColor.clear
    override func ys_setupMaskView() -> (backgroundColor: UIColor, alpha: CGFloat) {
        return (UIColor.black,0.5)
    }

    @IBAction func dismissAction(_ sender: UIButton) {
        dismiss(animated: true, completion: nil)
    }
}

PresentingViewController 使用说明及示例

1、在需要Modal展现的地方,直接present即可,注意,presentedVC一定是YSModalTopToBom_presentedVC子类对象

import UIKit

class ViewController: UIViewController{

    override func viewDidLoad() {
        super.viewDidLoad()
        }

    @IBAction func modalAction(_ sender: UIButton) {
        let sb = UIStoryboard(name: "Main", bundle: nil)
        let presentedVC = sb.instantiateViewController(withIdentifier: "p") as! YSModalTopToBom_presentedVC

        // Modal展现
        present(presentedVC, animated: true, completion: nil)
    }
}

Latest podspec

{
    "name": "YSModal_topToBom",
    "version": "1.0.5",
    "summary": "u6a21u6001u5f39u6846(u4eceu4e0au5f80u4e0b)uff0cu81eau5b9au4e49u9ad8u5ea6uff0cu9876u90e8u4e0eu5c4fu5e55u5bf9u9f50uff0cu5e95u90e8u4e3au534au900fu660e",
    "homepage": "https://github.com/yscode001/YSModal_topToBom",
    "license": "MIT",
    "authors": {
        "ys": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/yscode001/YSModal_topToBom.git",
        "tag": "1.0.5"
    },
    "source_files": "YSModal_topToBom/YSModal_topToBom/YSModal_topToBom/*.swift",
    "frameworks": "UIKit",
    "dependencies": {
        "YSBase": []
    }
}

Pin It on Pinterest

Share This