swift floatWindow 自定义 iphone小圆点

2018-05-11  本文已影响0人  wangtieshan

KKFloatWindow create a float window, to do some extra things

环境:


Xcode:Xcode 8.2

Swift:swift3+

pod 集成:

pod 'KKFloatWindow', '1.2.0'

源码集成:

https://github.com/TieShanWang/SMFloatWindow

【效果图】

floatwindow.gif

KKFloatWindow

漂浮的窗口,与系统自带的小圆点一模一样

class KKFloatWindow

open var items: [KKFloatWindowItem]?

浮窗上小圆点项目。

小圆点展开后,右上角设置,展示的列表

open weak var delegate: KKFLoatWindowDelegate?

窗口小圆点点击某个项目后的点击事件回调

open var panGestureRecognizer: UIPanGestureRecognizer!

窗口小圆点的手势

open class func defaultFloatWindow(_ delegate: KKFLoatWindowDelegate) -> KKFloatWindow?

创建默认功能的 window,默认大小 (2, 100, 60, 60)

小圆点圆角 13

windowLevel: UIWindowLevelStatusBar

debug 下返回一个对象,release 下返回nil

class KKFloatWindowItem

    
/// Set up a ID to distinguish
open var name: String!
    
/// icon image
open var image: UIImage?
    
/// icon image name, will use init(named:) to load
open var icon: String?
    
/// icon image sandbox path, will use init(contentsOfFile:) to load, NSHomeDirectory + iconSandboxPath
open var iconSandboxPath: String?
    
/// if tintColor is not nil, will use renderMode: .AlwaysTemplate
/// and will use tintColor to set titleColor, if titleColor is nil
open var tintColor: UIColor?
    
/// color for text, not be used in this version
var titleColor: UIColor?

/// 如果设置,KKFloatWindow 会直接将此 ViewController 弹出(无论在任何界面)
/// 设置了presentedViewController 自动弹出
/// 否则点击后调用代理的 floatWindowSelectedItem 回调
open var presentedViewController: UIViewController?

KKFLoatWindowDelegate

func floatWindowSelectedItem(_ item: KKFloatWindowItem)

选中条目的回调

KKFloatView

open var autoJustAlpha: Bool = true

当拖动位置时自动调整 alpha
如果为 true,alpha 为 0.7

weak open var containerView: UIView?

设置所在的容器了,用来定位边缘,不设置默认 superView

open var panGestureRecognizer: UIPanGestureRecognizer!

 移动窗口的手势

【建议】

可以将

iOS swift oc 类似安卓 文件管理器 查看、管理、导出沙盒目录

一起使用,在APP任何地方均可打开沙盒目录,实时查看沙盒文件

【声明】

此公共库为个人所有,业余时间编写,与任何公司或组织均无关系

使用该公共库的组织或者公司,本人有权收回使用权

上一篇 下一篇

猜你喜欢

热点阅读