项目作者: ajijoyo

项目描述 :
Simple popup message
高级语言: Swift
项目地址: git://github.com/ajijoyo/AJMessage.git
创建时间: 2018-12-19T04:23:32Z
项目社区:https://github.com/ajijoyo/AJMessage

开源协议:MIT License

下载


AJMessage

Language
CI Status
Version
License
Platform

Example

demo

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

Requirements

  1. XCode 10.2
  2. Swift 5

Installation

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

  1. pod 'AJMessage'

Changelog

  • separated function show with initial view :
  1. AJMessage(title: title, message: msg).show()
  2. //or
  3. let asd = AJMessage(title: title, message: msg)
  4. asd.show()
  • function callback onHide has deprecated and changed to onDismiss and have value AJMessage class
  • add new configuration of backgroundcolor setBackgroundColor for each status
  • add new configuratoin of icon setImage for each status

Used

Simple used

  1. AJMessage.show(title: "This is title", message: "message for description",position:.top).onHide {
  2. print("did dissmiss")
  3. }

Can use NSAttributeString

  1. let title = NSAttributedString(string: "Title", attributes: [.font:UIFont.systemFont(ofSize: 15)])
  2. let msg = NSMutableAttributedString(string: "aasdasd", attributes: [.font:UIFont.systemFont(ofSize: 14)])
  3. let attach = NSTextAttachment()
  4. attach.image = UIImage(named:"plus")
  5. msg.append(NSAttributedString(attachment: attach))
  6. msg.append(NSAttributedString(string: "asdasdasdasd asdasdasdasd asdasdasdasd asdasdasdasd asdasd"))
  7. AJMessage.show(title: title, message: msg,position:.top).onHide {
  8. print("did dissmiss")
  9. }

customize config

for spesific view present

  1. var config = AJMessageConfig()
  2. /**
  3. config.titleFont
  4. config.setBackgroundColor(.cyan, status: .success)
  5. config.setImage(UIImage(named:"warning"), status: .info)
  6. */
  7. AJMessage.show(title: "This is title", message: "message for description", config: config)

for global view present
just set AJMessageConfig.shared on didFinishLaunchingWithOptions

  1. var config = AJMessageConfig.shared
  2. /**
  3. config.titleFont
  4. config.setBackgroundColor(.cyan, status: .success)
  5. config.setImage(UIImage(named:"warning"), status: .info)
  6. */

Author

ajijoyo, self.ajiejoy@gmail.com

License

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