👋 Hey
I'm a software engineer, I mainly work with Swift and Typescript + React. Once I close my laptop I get into my workshop for some hand tools woodworking 🔨
An animated popover that pops out a given frame, great for subtle UI tips and onboarding.
License: MIT License
👋 Hey
I'm a software engineer, I mainly work with Swift and Typescript + React. Once I close my laptop I get into my workshop for some hand tools woodworking 🔨
the pop tip text frame is not centred from the sender frame for large text
From the latest travis builds:
$ slather
Slathering...
/Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/lib/slather/project.rb:50:in `coverage_files': No coverage files found. Are you sure your project is setup for generating coverage files? Try `slather setup your/project.pbxproj` (StandardError)
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/lib/slather/coverage_service/coveralls.rb:76:in `coveralls_coverage_data'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/lib/slather/coverage_service/coveralls.rb:129:in `post'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/bin/slather:72:in `post'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/bin/slather:40:in `execute'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/clamp-0.6.5/lib/clamp/subcommand/execution.rb:11:in `execute'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/clamp-0.6.5/lib/clamp.rb:6:in `Clamp'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/gems/slather-1.8/bin/slather:6:in `<top (required)>'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/slather:23:in `load'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/slather:23:in `<main>'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `eval'
from /Users/travis/.rvm/gems/ruby-2.0.0-p481/bin/ruby_executable_hooks:15:in `<main>'
Looks like that Slather is failing even if the setup was performed (it was working before after all).
Any idea is welcome 😁
Hi,
I would like to use this control centered in a view. I think you could mimic the behavior of UIPopovers by adding a AMPopTipDirectionNone
direction enum value and center in the destination view frame.
Thanks for considering!
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 100, 200)];
tableView.delegate = self;
tableView.dataSource = self;
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
[customView addSubview:tableView];
[self.popTip showCustomView:customView direction:AMPopTipDirectionDown inView:self.view fromFrame:sender.frame];
This is a beautiful tipview I have used in my project but I think it is really cool if you can add those features.
Thank
It would be great to have an option to create shadows around the PopTip. It's an amazing repo by the way; this is just an enhancement.
How do I show multiple popTips at the same time?
Newer versions of Carthage require dSYMs to be uploaded with the build. Since the binary was build with an older version of Carthage, it is missing the require dSYM
Hello again @andreamazz,
I noticed a bug. If I set the arrowSize this way:
[AMPopTip appearance].arrowSize = CGSizeMake(10.0f, 18.0f);
It is showing correctly with right / left directions:
But it reverse the values for up / down directions:
Can you look at this please?
Thank you 👍
Dropped AMProTip folder in and setup bridge header, no issues. Added this code
var popTip: AMPopTip = AMPopTip()
popTip.showText("This is a test", direction: AMPopTipDirection.Up, maxWidth: 40, inView: self.view, fromFrame: CGRect(x: 0, y: 0, width: 40, height: 20))
getting this error on compile
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_AMPopTip", referenced from:
__TMaCSo8AMPopTip in DetailViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Couple of other ideas that would be great in my situation...
inBlock parameter: a block that is executed when the poptip appears. This is the opposite of the dismissBlock.
example: I am highlighting certain UI elements when the poptip appears and would do it in this block.
delay parameter: a delay before the poptip is shown.
example: I don't want the poptip to appear right away, it is more likely to get attention after a short delay.
These are feature that I've implemented in my own view controllers but would be great if they were contained within the poptip itself.
I am trying to add a tap gesture to the popover so that when it is clicked I want to call a function which does some basic tasks. I tried this but doesn't seem to work:
self.helpTip!.userInteractionEnabled = true self.helpTip!.addGestureRecognizer(UITapGestureRecognizer(target: self, action: Selector("demo")))
Please help!
Hi @andreamazz
When I add an ActionAnimation, I have to tap it a many times super fast to get it to randomly dismiss.
However, if I remove the ActionAnimation it dismisses on first tap.
PopTips do not play nice in Nested Frames or in UIStackViews.
The arrow points to the inside of the frame at a position that is difficult to determine beforehand.
Any ideas?
Adding a prebuilt binary to the tag will make it quicker for people using Carthage to use AMPopTip
.
Just
carthage build --no-skip-current
carthage archive AMPopTip
and attach the created zip to the current tag
Hello,
I am trying to add a pop tip to a scroll view but nothing shows up. When I look at the subviews of the scrollview the AMPopTip is there but the frame is 0. What could be causing this?
<AMPopTip: 0x7fbdfc8bfe00; frame = (0 0; 0 0); text = 'Tap to be...'; animations = { transform=<CASpringAnimation: 0x7fbdfa55a520>; }; layer = <CALayer: 0x7fbdfc8893b0>>
Thanks!
Michael
This is super cool library, thanks for making it.
It would be awesome if you could add getting frames for navigation bar items like right navibar button frame.
Is there any way to get the frame of self.navigationItem.leftBarButtonItem at the moment? I've been trying to find out the way, but no luck yet.
When i try to use the PopTip on a Scrollable view (most in cases of 3.5") only works when the view is in the original position, when you change, the PopTip remains on that position, doesn't change even when you try to show it again...
Add a shouldDismissOnTapOutside property to specify whether to dismiss when tapping outside the popover.
In ScrollView if you scroll down or up and trigger the PopTip it will point faraway from the frame it was supposed to point on. every time you change the position of the view the PopTip will point on different spot.
Thanks in advance
Is it possible to use this with a UIBarButtonItem?
leftBarButtonItem could be hacked as it will always be on the top left of the view, but what abut a rightBarButtonItem?
sorry it was my silly mistake
I'm showing tooltip over a collection view cell that was pressed last. If I just call showText:
on every click, tolltip opens only after the first click and does nothing on the next clicks. It would be good, if tooltip would update it's position and text when showtext:
is called on the already visible tooltip.
PS. For the moment I made two tooltip objects and hide one and show second one on click, but that doesn't seem right.
I have a tip displayed that explains they need to tap on a button to do something. If the user then actually taps the button (and not the tip), the tip doesn't get dismissed. Is there any way to get this behavior or is this a bug?
Hi, I'm using this with Swift and a bridging header so that could be the reason it't not working.
I basically want the tip to appear as soon as the app is open:
var popTip = AMPopTip()
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(true)
popTip.showText("If you like the quote, swipe the card to the right…otherwise swipe to the left! ", direction: AMPopTipDirection.Down, maxWidth: 260, inView: self.view, fromFrame:card1.frame)
}
Any ideas? Thanks :)
Hello I am building the AMPopTip with this code as mentioned , but the UI hangs if I use the XIB created custom view.
@Property (nonatomic, strong) AMPopTip *popTip1;
@Property (nonatomic, strong) CLInfoPopUpView *popUpView; //My view
//Initialised tried using local in button tape or in View did load as well :
CLInfoPopUpView * popView = [[[NSBundle mainBundle] loadNibNamed:@"CLInfoPopUpView" owner:self options:nil] lastObject];
self.popTip1 = [AMPopTip popTip];
self.popTip1.shouldDismissOnTap = YES;
self.popTip1.edgeMargin = 0;
self.popTip1.offset = 2;
self.popTip1.edgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
[self.popTip1 setBackgroundColor:[UIColor grayColor]];
[self.popTip1 setPopoverColor:[UIColor grayColor]];
The Button function of tap show this.
if ([self.popTip1 isVisible]) {
[self.popTip1 hide];
self.popTip1 = [AMPopTip popTip];
return;
}
[self.popTip1 showCustomView:popView direction:AMPopTipDirectionDown inView:self.view fromFrame:cell.infoBtn.frame];
Tool tip comes first time but later app hang no operations happening. Similarly if I try using the UIview alloc init method to make the custom view as u show in Demo it work , can you help why this is happening.
it can't use in UITableViewController
We are using AMPopTip in an app that supports both Portrait and Landscape. When a user rotates their device while a tooltip is visible, it obviously will now point at an incorrect location.
I know that AMPopTip is just a UIView that I'm free to position myself. However, all the calculation for how to position the tooltip correctly is internal to AMPopTip and I'd rather not recreate this myself.
Would it be possible to expose a method that lets me update the "fromFrame" such that pop-tip will re-do it's setup
method with that new frame? That way on rotate I can check for any AMPopTip's where isVisible
is YES
and I'll send a new fromFrame to them?
The following lines are causing crashes on my iPod running iOS 7:
AMPopTip.appearance().shouldDismissOnTap = true
AMPopTip.appearance().shouldDismissOnTapOutside = false
The crash says:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* Illegal property type, c for appearance setter, _installAppearanceSwizzlesForSetter:'
Hi-
Great library, thanks for your hard work!
I would really like to see a block parameter, similar to tapHandler, that would be executed when the tip is dismissed no matter if the tip was dismissed manually, by timer duration or by tap.
For example, in this block I would mark this tip as "seen" the user defaults.
When a XIB custom view, aotulayout can't use, for the first time show popTipView is normal, but closed again after opening will cause a suspended animation!
}
These two methods will call cycles
(void)show {
if (self.isVisible || self.isAnimating) {
return;
}
self.isAnimating = YES;
[self setNeedsLayout];
[self performEntranceAnimation:^{
[self.containerView addGestureRecognizer:self.tapRemoveGesture];
[self.containerView addGestureRecognizer:self.swipeRemoveGesture];
if (self.appearHandler) {
self.appearHandler();
}
if (self.actionAnimation != AMPopTipActionAnimationNone) {
[self startActionAnimation];
}
self.isVisible = YES;
self.isAnimating = NO;
}];
}
[self performEntranceAnimation:^{
}];
This method of correction will not be invoked
Hi @andreamazz, thank you for your super AMPopTip
! :)
What do you think of adding a property like arrowRadius
to have a rounded arrow?
I would like it very much! Something like this:
Hello @andreamazz,
I was thinking it could be great to let the user have a choice for the appearance animation, maybe via a UI_APPEARANCE_SELECTOR
enum property like:
typedef NS_ENUM(NSInteger, AMPopTipAppearanceAnimation) {
AMPopTipAppearanceAnimationScaleUp, // scale 2.0 to 1.0
AMPopTipAppearanceAnimationScaleDown, // scale 0.3 to 1.0
AMPopTipAppearanceAnimationFadeIn, // alpha 0 to 1
AMPopTipAppearanceAnimationFadeInTranslate, // alpha 0 to 1 and shift from an offset to final position (translation is depending on popover direction)
AMPopTipAppearanceAnimationNone // no animation at all
};
@property (nonatomic, assign) AMPopTipAppearanceAnimation defaultAppearanceAnimation UI_APPEARANCE_SELECTOR;
What do you think of that?
It could also provide a custom animation block for each AMPopTip
instance:
@property (nonatomic, copy) void (^appearanceAnimationSetup)(void);
@property (nonatomic, copy) void (^appearanceAnimation)(void);
where a user could do something like:
popTip. appearanceAnimationSetup = ^ {
popTip.alpha = 0;
};
popTip. appearanceAnimation = ^ {
popTip.alpha = 1;
};
Or, we can let the user control entirely the animation by doing instead:
@property (nonatomic, copy) void (^appearanceAnimation)(void (^completion)(void));
And implementing it like:
popTip. appearanceAnimation = ^(void (^completion)(void)) {
popTip.alpha = 0;
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:1.5 options:(UIViewAnimationOptionCurveEaseInOut) animations:^{
popTip.alpha = 1;
} completion:completion];
}
Where he has to call back the completion so in AMPopTip
code, it knows when to do after animation code.
The second idea for custom animation might be a little bit too permissive because it makes animationIn
and delayIn
obsolete. Also, for the custom animation, we should provide same properties but for hiding the popover.
When PopTip is used on a UICollectionViewCell area didSelectItemAtIndexPath: delegate does not get called. I believe this could be the effect of the "remove" gesture recognizer which is not required in my particular case.
Was able to fix this by adding;
- (void) setShouldDismissOnTapOutside:(BOOL)shouldDismissOnTapOutside
{
_shouldDismissOnTapOutside = shouldDismissOnTapOutside;
_removeGesture.enabled = shouldDismissOnTapOutside;
}
I've can use all PopTip functionality like this:
self.tooltip.showText(self.pocketText, direction: AMPopTipDirection.Up, maxWidth: 260, inView: self.view, fromFrame:self.navigationBar.frame)
self.tooltip.popoverColor = greenColor
but somehow it is not possible for me to set bounce like this:
self.tooltip.bounce = true
What am I doing wrong?
Thanks in advance :)
i want to know ,how can i set a custom view on the popview? only text avaliable?
In the hide method in AMPopTip, the tip view will be removed only when finished == YES. However, finished == NO could also happen when put [myTip hide] into viewWillDisappear. So in this case, myTip.isVisible could still return YES even I have called [myTip hide].
When the app goes to background with poptip (with a duration) showing and become foreground again, the poptip dismisses but the dismissHandler it not called. And isVisible is always true
For some reason 0.9.12 seems to be the latest version that cocoapods knows about.
It would be really great to add feature to set position of poptip arrow (not only center, but left and right (after edge insets settings)).
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.