Skip to content

Instantly share code, notes, and snippets.

@francisjervis
Created March 4, 2015 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francisjervis/1b022e05f948a2e71770 to your computer and use it in GitHub Desktop.
Save francisjervis/1b022e05f948a2e71770 to your computer and use it in GitHub Desktop.
//
// ViewController.swift
// tooltip
//
// Created by francis on 2/20/15.
// Copyright (c) 2015 timesfree. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var button: UIButton!
var toolTipMgr: JDFSequentialTooltipManager?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
toolTipMgr = JDFSequentialTooltipManager(hostView: self.view)
toolTipMgr!.addTooltipWithTargetView(button, hostView: self.view, tooltipText: "tip", arrowDirection: JDFTooltipViewArrowDirection.Down, width: 180.0)
let screenWidth = self.view.bounds.width
let midPoint = screenWidth / 2
toolTipMgr?.addTooltipWithTargetPoint(CGPoint(x: (screenWidth - 20), y: 40), tooltipText: "from point", arrowDirection: JDFTooltipViewArrowDirection.Up, hostView: self.view, width: 200.0)
// toolTipMgr?.showsBackdropView = true
toolTipMgr?.setBackgroundColourForAllTooltips(UIColor(red: (232/255.0), green: (239/255.0), blue: (254/255.0), alpha: 1.0))
toolTipMgr?.setFontForAllTooltips(UIFont(name: "AppleSDGothicNeo-SemiBold", size: 16.0))
toolTipMgr?.setTextColourForAllTooltips(UIColor.blackColor())
toolTipMgr!.showNextTooltip()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment