teodorpatras / easytipview Goto Github PK
View Code? Open in Web Editor NEWFully customisable tooltip view in Swift for iOS.
License: MIT License
Fully customisable tooltip view in Swift for iOS.
License: MIT License
I've programmatically created a right bar button item. When I run
EasyTipView.showAnimated(true,
forView: navigationItem.rightBarButtonItem,
withinSuperview: self.navigationController?.view,
text: "Tip view inside the navigation controller's view. Tap to dismiss!",
preferences: preferences,
delegate: self)
The error states I can't convert the UIBarButtonItem to UIView. Obviously if I had an IBOutlet it would work but I created this bar button item programmatically. How can I get this to work for my situation?
Currently we can display a tip view above another view (view A), with the tip view horizontally aligned with view A. Is it possible to specify offset? For example:
Center tip view, with 10px to the right;
Place the tip view on the right, with 20px to the left.
Thanks!
As the title says, in my class declaration I have a var helpTip : EasyTipView! and then perform some code in a function below. Whenever I dismiss the helpTip, either programmatically, or by clicking the tooltip itself, the function is never called. Is there anything I'm not doing?
New to swift, so having trouble understanding how to dismiss the tooltip. I have it so when i click a button the tool tip displays, which it does. But will not dismiss. Thought to create a check variable for when the tool tip is displayed and the button is tapped again it is dismissed, but not working.
@IBAction func whyAction(sender: AnyObject) {
let easy = EasyTipView(text: "Your privacy is respected per our Privacy Policy", preferences: EasyTipView.Preferences.init(), delegate: self)
if tipViewStart == 0 {
easy.showForView(sender as! UIView, withinSuperview: nil, animated: true)
tipViewStart = 1
} else {
easy.dismissWithCompletion(nil)
tipViewStart = 0
}
}
Just an update, didn't realize you had to click the tooltip to have it disappear... duh on my part. But nevertheless, can i dismiss by clicking on the button?
Could not able to Display tipview at the bottom of textField
Following is my code instead of showing it in the bottom it will show it on top of textfield does there is anything wrong with my side ?
guard let _ = whenDidYouStartTextField.text where whenDidYouStartTextField.text?.characters.count > 0 else {
var pref2 = EasyTipView.Preferences()
pref2.drawing.font = UIFont(name: "Futura-Medium", size: 13)!
pref2.drawing.foregroundColor = UIColor.whiteColor()
pref2.drawing.backgroundColor = UIColor.redColor()
pref2.drawing.arrowPosition = EasyTipView.ArrowPosition.Bottom
let tipView = EasyTipView(text: "Please select when you start.", preferences: pref2)
tipView.show(animated: true, forView: whenDidYouStartTextField, withinSuperview: self.tableView, autoDismissAfter: 3)
return
}
Extension of EasytipView
//
// EasyTipView+Extension.swift
// ScalpCoach
//
// Created by IndrajitSinh Rayjada on 09/08/16.
// Copyright © 2016 Indrajit. All rights reserved.
//
import Foundation
import EasyTipView
extension EasyTipView {
func show(animated animated: Bool = true, forView view: UIView, withinSuperview superview: UIView? = nil, autoDismissAfter: Double) {
self.show(animated: animated, forView: view, withinSuperview: superview)
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(autoDismissAfter * Double(NSEC_PER_SEC)))
dispatch_after(delayTime, dispatch_get_main_queue()) { [weak self] in
self?.dismiss()
}
}
}
What you think about this:
class func hideAllInSuperView(sview: UIView) {
for subview in sview.subviews {
if subview is EasyTipView {
let sub = subview as! EasyTipView
UIView.animateWithDuration(0.2, animations: { () -> Void in
sub.transform = CGAffineTransformMakeScale(0.3, 0.3)
sub.alpha = 0
}) { (finished) -> Void in
sub.removeFromSuperview()
}
}
}
}
Hello,
is there a way to show a UIView (with UIImage) instead of only text?
Congrats for the great work.
I have Xcode 8 and trying to convert my project to Swift 3.
In my Podfile:
pod 'EasyTipView', '~> 1.0.2'
When I build the project, I get:
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
What am I doing wrong?
After upgrading to Swift 2.2 with Xcode 7.3, I've run into this build error
…/Pods/EasyTipView/Source/EasyTipView.swift:189:20: Use of unresolved identifier '_stdlib_getDemangledTypeName'
Any hints to fix it would be much appreciated.
Any plans for adding IBInspectable / IBDesignable support so that it becomes a bit easy for use in storyboard? Also it would be a good idea to support encoding / decoding by subclassing NSCoder.
How custom background?
I want to use background image.
I tried to create tooltip inside tableview cell component, but... the position mess up after tableView is scrolled or reloaded..
is there any solution for this ?
Thank you in advance
Nice Library
Title says it all, very simple change. Seems kind of strange not being able to get the current text string that is set.
Will submit a PR for this soon unless someone else beats me to it.
Is there a way to get the EasyTipView instance created with show method? E.g. to store it so later I can close them all if more than one on screen?
I'm using the swift 2.2/2.3 version and I have only the .dismiss function but not the dismissWithCompletion.
How can I do something else when I dismiss one EasyTipView (i.e and show another one)
If the text contained in the tip view is too short, making the width of the tooltip too small compared to the width of the view target, the arrow tip will be displayed at far right.
To replicate the issue just give the C rectangle in the example a width of 80, and write inside the relative tooltip the word "Tip".
I'll also look into this in the next days if I have some free time.
Thank you!
I have a form with fields that are stack in a UIStackView. does this pod not capable to be use with stackView i tried this but does not work
var preferences = EasyTipView.Preferences()
preferences.drawing.backgroundColor = UIColor(hue:0.58, saturation:0.1, brightness:1, alpha:1)
preferences.drawing.foregroundColor = UIColor.darkGray
preferences.drawing.textAlignment = NSTextAlignment.center
preferences.animating.dismissTransform = CGAffineTransform(translationX: 100, y: 0)
preferences.animating.showInitialTransform = CGAffineTransform(translationX: -100, y: 0)
preferences.animating.showInitialAlpha = 0
preferences.animating.showDuration = 1
preferences.animating.dismissDuration = 1
let view = EasyTipView(text: "Tip view within the green superview. Tap to dismiss.", preferences: preferences)
view.show(forView: buttonA, withinSuperview: self.myStackView)
Everything was fine when I clicked a button to show the tip view the first time, as well as I tapped the tip view to dismiss it:
Problem is that when you click the button to show the tip view again, odd thing happens:
Here's the demo which can reproduce the issue: EasyTipViewDemo.zip.
So, I have did this in my viewDidLoad:
EasyTipView.show(forView: self.shareBtnO,
withinSuperview: self.gradientView,
text: "Share",
preferences: tooltipPreferences ,
delegate: nil)
Preferences:
var tooltipPreferences = EasyTipView.Preferences()
tooltipPreferences.drawing.font = UIFont(name: "FaktPro-Normal", size: 16)!
tooltipPreferences.drawing.foregroundColor = UIColor.whiteColor()
tooltipPreferences.drawing.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1)
tooltipPreferences.drawing.arrowPosition = EasyTipView.ArrowPosition.Top
EasyTipView.globalPreferences = tooltipPreferences
but the the app crashes with error:
precondition failed: The supplied superview <<UIView: 0x16d8d670; frame = (0 0; 600 600); autoresize = W+H; layer = <CALayer: 0x16d8d730>>> is not a direct nor an indirect superview of the supplied reference view <<UIButton: 0x16e79ff0; frame = (-23 -15; 46 30); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x16e7a2e0>>>. The superview passed to this method should be a direct or an indirect superview of the reference view. To display the tooltip within the main window, ignore the superview parameter.: file /Users/perte/Documents/GitHub/project/Pods/EasyTipView/Source/EasyTipView.swift, line 94
I tried self.shareBtnO.superview instead of self.gradientView . I can't let that parameter empty because otherwise the tooltip appears under the my gradient view, like here
That would be really nice, since we could then freely stylise the text in the tip view.
Hey, I love this library. API is simple and easy to use. Only feature that's missing for me is the ability to set a timer on the view and have it automatically dismiss itself. Thanks.
Hi
0.1.8 can not support Swift3.0
is there a Swift3.0 branch or tag
Thank you
I've tried to install 1.0.0 (or 1.0.1) version (one before Swift 3) but it is using 1.0.2 whatever version I will choose:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
target 'EasyTipView-Example' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for EasyTipView-Example
pod 'EasyTipView', '~> 1.0.1'
end
and here is the terminal output:
Analyzing dependencies
Downloading dependencies
Using EasyTipView (1.0.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total
pod installed.
I have been using EasyTipView to implement a demo system within the app. It works well but I found that creating the tipview and then showing it caused dismissal to not trigger the onDismiss delegate. To get around this, I have used the class show functions. When the tip is dismissed, the delegate method is called, which is great. However, I then have no way to dismiss a tip using the dismiss function within my own code. To address this, I simply altered the code to return the EasyTipView from the class functions. It seems to work well. I will try to put a pull request in place to make the change available if you wish to include it.
Thanks for making the code available!
Geoff S
Am trying to implement this in a tableviewcell, but the arrow position of top or bottom ends up partially layered underneath neighboring cells due to the structure of the tableview.
I have issues when showing tips for elements that are not visible on screen (view.window is nil)
Tips showed for current screen but not for uiview controls which are not visible for user.
When I scroll th screen, those tips are also scrolled up with screen. Is there some elegant solution for this problem, so I can put tips on proper position for those controls?
I tried to scroll up grammatically, and then show tips, but tips are still scrollable.
Is there a way to set a tipView duration? (something like an auto dismiss after a established period)
Thank you for your work.
Ref: cocoapods.org
I expected easyTipViewDidDismiss to be called when doing
self.tipView.dismiss()
but it isn't.
I do that when the user taps an overlay.
easyTipViewDidDismiss is called when the user taps the tipView (so the delegate should be correct).
Is it an issue or am I holding it wrong?
Any easy way to accept touches (outside of the tooltip view) to dismiss the tooltip?
As Xcode 7.3 is released and _stdlib_getDemangledTypeName
unresolved error is merged to master could you please create new version?
After updating the code to swift3 so it would run in my project, I'm having a strange issue where it doesn't draw the final addArc rounded corner. It only does this when the arrow is on the right side. It's the final line of this function that does the drawing:
fileprivate func drawBubbleRightShape(_ frame: CGRect, cornerRadius: CGFloat, path: CGMutablePath) {
path.addArc(tangent1End: CGPoint(x: frame.origin.x + frame.width, y: frame.origin.y), tangent2End: CGPoint(x: frame.origin.x, y: frame.origin.y), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.origin.x, y: frame.origin.y), tangent2End: CGPoint(x: frame.origin.x, y: frame.origin.y + frame.height), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.origin.x, y: frame.origin.y + frame.height), tangent2End: CGPoint(x: frame.origin.x + frame.width, y: frame.origin.y + frame.height), radius: cornerRadius) path.addArc(tangent1End: CGPoint(x: frame.origin.x + frame.width, y: frame.origin.y + frame.height), tangent2End: CGPoint(x: frame.origin.x + frame.width, y: frame.height), radius:cornerRadius) }
For the life of me I can't see why it doesn't draw the rounded corner. Any ideas?
For some reason, the EasyTipView will not show Chinese characters in my code. It works for Japanese characters but not Chinese wording ... any thought on this?
EasyTipView(text: "觀看更多內容", preferences: preferences, delegate: self)
The EasyTipView/EasyTipView-Swift.h
that is being compiled only supports:
@property (nonatomic, strong) UIColor * _Nullable backgroundColor;
- (void)showWithAnimated:(BOOL)animated forItem:(UIBarItem * _Nonnull)item withinSuperView:(UIView * _Nullable)superview;
- (void)showWithAnimated:(BOOL)animated forView:(UIView * _Nonnull)view withinSuperview:(UIView * _Nullable)superview;
- (void)dismissWithCompletion:(void (^ _Nullable)(void))completion;
It's impossible to even set the text
or description
of the tooltip..
Hi,
After updating to 0.2.1 i encountered a problem when the delegate easyTipViewDidDismiss(tipView : EasyTipView)
called twice.
In the arrange
function the refViewFrame
is calculated with an extension to UIView
called originWithinDistantSuperView
.
In iOS 8 there is native support for that functionality (https://developer.apple.com/reference/uikit/uiview/1622442-convert)
let refViewFrame = CGRect(origin: presentingView!.originWithinDistantSuperView(superview), size: presentingView!.frame.size)
can be replaced by
let refViewFrame = presentingView!.convertRect(presentingView!.bounds, toView: superview)
(in swift 3 it has changed name to just convert
)
I've created a fork with a 'swift-3.0' branch containing change with support for Swift 3.
https://github.com/kevinwo/EasyTipView/tree/swift-3.0
Test are still passing and the example app appears to run as expected on iOS 10. If the fork looks good and a new branch is created here, I'd be happy to submit a pull request. Please let me know if you have any thoughts or questions. Thanks!
I have an app with navigationBar and tabBar. What I want is to dismiss EasyTipView when user clicks anywhere outside of the tip. How can it be implemented?
Hi there,
This library really look great. But not sure if it is possible for to use for Obj-C project?
Cause I've tried to "pod install" it to my Obj-C project, and realized that inside EasyTipView.h only have 2 methods and not able for us to set text for it.
Hoping you can spend some minutes to help on this, appreciate it much.
Kindly implement arrow direction None for general uses
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.