Git Product home page Git Product logo

amtooltip's Introduction

AMTooltip

CI Status Version License Platform

Screenshots

Requirements

iOS 8+

Expample write in Xcode 8.3 - Swift 3.1

Installation

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

pod "AMTooltip"

Usage (swift 3)

import AMTooltip

With focus view and default options:

          AMTooltipView(message: "some text",
                        focusView: focusView, //pass view you want show tooltip over it
                        target: self)  //you can pass UIViewController or UIView as target

With focus frame and default options:

          AMTooltipView(message: "some text",
                        focusFrame: CGRect(x:100, y:150, width:40, height:25)
                        target: self) 

With custom options:

          AMTooltipView(
            options:AMTooltipViewOptions(
                textColor: UIColor.white,
                textBoxBackgroundColor: UIColor.gray,
                addOverlayView: false,
                lineColor: UIColor.gray,
                dotColor: UIColor.lightGray,
                dotBorderColor: UIColor.gray
            ),
            message: "some customized text",
            focusView: focusView,
            target: self)

With dismiss closure:

        AMTooltipView(message: "some text",
                      focusView: focusView,
                      target: self) {
                      
                        print("tooltip dismissed") 
        }

Options

Name Type Default Description
side AMTooltipViewSide .auto Side of show tooltip (.auto/.top/.bottom)
textColor UIColor UIColor.black Color of message text
textWidth CGFloat 270 Width of message
font UIFont UIFont.systemFont(ofSize: 14) Font of message text
textAlignment NSTextAlignment .natural Alignment of message text
textBoxBackgroundColor UIColor UIColor.white Color of message box
textBoxCornerRadius CGFloat 6 Radius for corners of message box
textBoxBorderColor UIColor UIColor.clear Color for border of message box
textBoxBorderWidth CGFloat 0 Width for border of message box
addOverlayView Bool true if false dark overlay view hide
overlayBackgroundColor UIColor UIColor.black.withAlphaComponent(0.4) Color of overlay view
lineColor UIColor UIColor.white Color of pin line view
lineWidth CGFloat 2 Width of pin line view
lineHeight CGFloat 30 Height of pin line view
dotColor UIColor UIColor.lightGray Color of pin dot
dotSize CGFloat 13 Size of pin dot
dotBorderWidth CGFloat 2 Size for border of pin dot
dotBorderColor UIColor UIColor.white Color for border of pin dot
focusViewRadius CGFloat 6 Radius for corners of focused view
focustViewVerticalPadding CGFloat 5 Vertical padding for focused view
focustViewHorizontalPadding CGFloat 15 Horizontal padding for focused view

Todo

  • Add support for screen rotate
  • Adjust messageBox with target view frame
  • Support left and right side
  • Custom animations
  • Custom pointers (arrow, images, ...)
  • Custom view instead tooltip box

License

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

amtooltip's People

Contributors

amirdew avatar

Watchers

 avatar  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.