Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metinkilicaslan/MKToolTip
MKToolTip is a customizable tooltip view written in Swift that can be used as a informative tip
https://github.com/metinkilicaslan/MKToolTip
Last synced: about 1 month ago
JSON representation
MKToolTip is a customizable tooltip view written in Swift that can be used as a informative tip
- Host: GitHub
- URL: https://github.com/metinkilicaslan/MKToolTip
- Owner: metinkilicaslan
- License: mit
- Created: 2018-07-15T08:55:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-27T19:44:06.000Z (almost 3 years ago)
- Last Synced: 2024-11-11T11:03:49.690Z (about 1 month ago)
- Language: Swift
- Homepage:
- Size: 1.46 MB
- Stars: 156
- Watchers: 4
- Forks: 32
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cocoa - MKToolTip
README
[![Languages](https://img.shields.io/badge/language-swift%204.2%20|%20objc-FF69B4.svg?style=plastic)](#)
Description
--------------```MKToolTip``` is a customizable tooltip view written in Swift that can be used as a informative tip inside your both Swift and Objective-C projects.
Requirements
------------------------------ iOS 9.0+
Installation
--------------### CocoaPods
To integrate MKToolTip into your Xcode project using CocoaPods, specify it in your `Podfile`:
```ruby
pod 'MKToolTip'
```Then, run the following command:
```bash
$ pod install
```### Carthage
To integrate MKToolTip into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
github "metinkilicaslan/MKToolTip"
```Run `carthage update` to build the framework and drag the built `MKToolTip.framework` into your Xcode project.
### Manually
If you prefer not to use dependency managers, you can integrate MKToolTip into your project manually.
Usage
--------------1) First you should customize the preferences:
```swift
let gradientColor = UIColor(red: 0.886, green: 0.922, blue: 0.941, alpha: 1.000)
let gradientColor2 = UIColor(red: 0.812, green: 0.851, blue: 0.875, alpha: 1.000)
let preference = ToolTipPreferences()
preference.drawing.bubble.gradientColors = [gradientColor, gradientColor2]
preference.drawing.arrow.tipCornerRadius = 0
preference.drawing.message.color = .black
```2) Secondly call the ``showToolTip(identifier: title: message: arrowPosition: preferences: delegate:)`` method:
```swift
let view = UIView()
view.showToolTip(identifier: "identifier", title: "Dapibus", message: "Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.", arrowPosition: .top)
```Public interface
--------------### Delegate
```swift
public protocol MKToolTipDelegate: class {
func toolTipViewDidAppear(for identifier: String)
func toolTipViewDidDisappear(for identifier: String, with timeInterval: TimeInterval)
}
```### Public extension methods
```swift
public extension UIView {
public func showToolTip(identifier: String, title: String? = nil, message: String, arrowPosition: MKToolTip.ArrowPosition, preferences: ToolTipPreferences = ToolTipPreferences(), delegate: MKToolTipDelegate? = nil)
}public extension UIBarItem {
public func showToolTip(identifier: String, title: String? = nil, message: String, arrowPosition: MKToolTip.ArrowPosition, preferences: ToolTipPreferences = ToolTipPreferences(), delegate: MKToolTipDelegate? = nil)
}
```License
--------------MIT License, Copyright (c) 2018 Metin Kilicaslan, [@metinkilicaslan](https://twitter.com/metinkilicaslan)