Skip to content

MLFloatView Provides an animated and no animated way to display

License

Notifications You must be signed in to change notification settings

MrDML/MLFloatView

Repository files navigation

MLFloatView

CI Status Version License Platform

Preview

Demo

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

MLFloatView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MLFloatView'

Example Use

// 设置frame
func initializeStyleOne(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: true)
floatView = MLFloatView.init(image: UIImage.init(named: "redpacket"))
let size = (floatView.image?.size)!
let screenWidth = UIScreen.main.bounds.width
let screenHeigh = UIScreen.main.bounds.height
floatView.frame.origin = CGPoint(x: screenWidth - size.width - 20, y: screenHeigh - size.height - 50)
floatView.delegate = self
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view .insertSubview(floatView, at: self.view.subviews.count)
}

// 无需设置frame 快速创建
func initializeStyleTwo(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: true)
floatView =  MLFloatView.init(image: UIImage.init(named: "redpacket"), stopEdgeLocation: FloatViewAllShowState.AllShowRight)
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view.insertSubview(floatView!, at: self.view.subviews.count)
}

func initializeStyleThree(){
// 在初始化之前设置一些默认值
MLFloatView.configFloatViewDefaultValue(edgeScreenOffset: 5, distanceTaBarOffset: 20, isAnimation: false)
floatView =  MLFloatView.init(image: UIImage.init(named: "redpacket"), stopEdgeLocation: FloatViewAllShowState.AllShowRight)
floatView.clickActionBlock = {(floatView) -> Void in
print("\(#line):\(#function)")
}
self.view.insertSubview(floatView!, at: self.view.subviews.count)
}

Author

DML, [email protected]

License

MLFloatView is available under the MIT license. See the LICENSE file for more info.

About

MLFloatView Provides an animated and no animated way to display

Resources

License

Stars

Watchers

Forks

Packages

No packages published