项目作者: jriosdev

项目描述 :
Light Weight iOS chat Head with Badge
高级语言: Swift
项目地址: git://github.com/jriosdev/iOSChatHead.git
创建时间: 2018-10-23T06:54:59Z
项目社区:https://github.com/jriosdev/iOSChatHead

开源协议:MIT License

下载


iOSChatHead

Light Weight iOS chat Head with Badge

Swift 4.0
License
Platform
Star

Example

Features

  1. Gestures
    1. ` [single tap],[double tap],[longpress],[dragging],[drag done],[auto docking done]`
  2. Badge text for icon
    1. ` Fully customizable `
  3. Auto Docking
  4. All Attributes of UIButton

Manual

Just clone and add the following Swift files to your project:

  • iOSChatHead.swfit

Basic usage ✨

Code Method

  1. var chat1:iOSChatHead!
  2. override func viewDidLoad() {
  3. super.viewDidLoad()
  4. self.chat1 = iOSChatHead.init(frame: CGRect(x: 0, y: 150, width: 50, height: 50))
  5. self.chat1.badgeEdgeInsets = UIEdgeInsets(top: 10, left: 15, bottom: 0, right: 15)
  6. //chat1.setImage(#imageLiteral(resourceName: "cha1.png"), for: .normal)
  7. UIApplication.shared.keyWindow?.bringSubviewToFront(self.chat3)
  8. chat1.badgeString = "New"
  9. }

Other Options

Actions && Closures

  1. var tapBlock:(()->Void)?
  2. var doubleTapBlock:(()->Void)?
  3. var longPressBlock:(()->Void)?
  4. var draggingBlock:(()->Void)?
  5. var dragDoneBlock:(()->Void)?
  6. var autoDockingBlock:(()->Void)?
  7. var autoDockingDoneBlock:(()->Void)?
  8. `

Customize iOSChatHead 🖌

You can customize with all properties of UIButton:
AND
You can customize these properties of the Badge:

  • badgeString : You can add badge for button.Default vaule is ""
  • cornerRadiusFactor : Factor that can change corner radius of badge. Default value is 2
  • verticalMargin : This is the space between text and badge’s vertical edge
  • horizontalMargin : This is the space between text and badge’s horizontal edge
  • badgeEdgeInsets: specify amount to inset (positive) for each of the edges. Type is UIEdgeInsets
  • badgeBackgroundColor: The badge Background Color. Default value is .red
  • badgeTextColor: This is Badge Text Color. Default value is .white
  • edgeInsetLeft: Can be adjust from Interface Builder EdgeInsetLeft
  • edgeInsetRight: Can be adjust from Interface Builder EdgeInsetRight
  • edgeInsetTop : Can be adjust from Interface Builder EdgeInsetTop
  • edgeInsetBottom: Can be adjust from Interface Builder EdgeInsetBottom
  • anchor: It represent different anchor on button Values are:0 = TopLeft,1 = TopRight,2 = BottomLeft,3 = BottomRight,4 = Center

Author

✨✨If you like my project please Give me a STAR on Github✨✨

Jishnu Raj T, jriosdev@gmail.com
Contact

License

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