Code Monkey home page Code Monkey logo

mktooltip's Introduction

Languages

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:

pod 'MKToolTip', :git => "https://github.com/mrugeshtank/MKToolTip.git"

Then, run the following command:

$ pod install

Carthage

To integrate MKToolTip into your Xcode project using Carthage, specify it in your Cartfile:

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:
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
  1. Secondly call the showToolTip(identifier: title: message: arrowPosition: preferences: delegate:) method:
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

public protocol MKToolTipDelegate: class {
    func toolTipViewDidAppear(for identifier: String)
    func toolTipViewDidDisappear(for identifier: String, with timeInterval: TimeInterval)
}

Public extension methods

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

mktooltip's People

Contributors

metinkilicaslan avatar mrugeshtank avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.