GithubHelp home page GithubHelp logo

andreamazz / ampoptip Goto Github PK

View Code? Open in Web Editor NEW
3.2K 71.0 436.0 4.14 MB

An animated popover that pops out a given frame, great for subtle UI tips and onboarding.

License: MIT License

Ruby 1.72% Swift 97.53% Objective-C 0.75%
popover poptip onboarding popup baloon

ampoptip's Introduction

Test suite

Animated popover that pops out of a frame. You can specify the direction of the popover and the arrow that points to its origin. Color, border radius and font can be easily customized. This popover can be used to leave subtle hints about your UI and provide fun looking onboarding popups.

Screenshot

AMPopTip

Versioning notes

With version 2.0.0 the library was re-written in Swift, and the API was slightly updated. Checkout version 1.5.x for the previous Objective-C implementation.

Version 3.0.0 introduces Swift 4 support, 3.5.0 Swift 4.2.

Setup with CocoaPods

  • Add pod 'AMPopTip' to your Podfile
  • Run pod install
  • Run open App.xcworkspace

Setup with Carthage

  • Add github "andreamazz/AMPopTip"
  • Run carthage update
  • Add AMPopTip.framework in your project

You can then import the framework in your project

import AMPopTip

Usage

The API is fairly straight forward, you can show and hide the popover at any time.

Showing the popover

You must specify the text that you want to display alongside the popover direction, its max width, the view that will contain it and the frame of the view that the popover's arrow will point to.

let popTip = PopTip()
popTip.show(text: "Hey! Listen!", direction: .up, maxWidth: 200, in: view, from: someView.frame)

You can also display the popover in the center, with no arrow, in this case the from can be the whole view:

popTip.show(text: "Hey! Listen!", direction: .none, maxWidth: 200, in: view, from: view.frame)

Coordinate system

Please note that the frame you are intended to provide needs to refer to the absolute coordinate system of the view you are presenting the popover in. This means that if you are presenting the popover in a view, pointing to a nested subview, you'll need to convert its frame using UIKit's convertRect(_:toView:). Read the reference here.

Direction

You can specify the direction that the tip will occupy, or you can let the library decide by using auto (all axis), autoHorizontal (only left or right) or autoVertical (only up or down). Once the popup is visible, the direction property will hold the direction that was decided.

Showing a custom view

You can provide a custom view that will be wrapped in the PopTip and presented.

let customView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
// Configure your view
popTip.show(customView: customView, direction: .down, in: view, from: someView.frame)

Showing a custom SwiftUI view

You can provide a custom SwiftUI view that will be embed in a UIHostingController, added to a parent controller and then wrapped in the PopTip and presented.

let customSwiftUIView = MySwiftUIView()
// Configure your view
popTip.show(rootView: customSwiftUIView, direction: .down, in: view, from: someView.frame, parent: someParentViewController)

Dismissing the popover

You can hide the popover by calling:

popTip.hide()

Or you can specify the duration of the popover:

popTip.show(text: "Hey! Listen!", direction: .up, maxWidth: 200, in: view, from: someView.frame, duration: 3)

You can also let the user dismiss the popover by tapping on it (default true):

popTip.shouldDismissOnTap = true

You can also let the user tap outside the popover dismiss the PopTip (default true):

popTip.shouldDismissOnTapOutside = true

You can also consider the origin frame as part of the popTip, i.e. treat the origin frame the same as tapping the popover (default false):

popTip.shouldConsiderOriginatingFrameAsPopTip = true

You can also consider the cutout as a separate tap area that will call a different callback (default false):

popTip.shouldConsiderCutoutTapSeparately = true

You can also allow the user to dismiss via swiping outside the PopTip (default false) (direction is controlled via popTip.swipeRemoveGestureDirection with UISwipeGestureRecognizer.Direction):

popTip.shouldDismissOnSwipeOutside = false

You can add a block that will be fired when the user taps the PopTip...

popTip.tapHandler = { popTip in
  print("\(popTip) tapped")
}

... when the cutout is tapped...

popTip.tapCutoutHandler = { popTip in
  print("\(popTip) cutout tapped")
}

... when the popover is shown...

popTip.appearHandler = { popTip in
  print("\(popTip) appeared")
};

... or when the popover is dismissed:

popTip.dismissHandler = { popTip in
  print("\(popTip) dismissed")
}

popTip.tapOutsideHandler = { _ in
  print("tap outside")
}

popTip.swipeOutsideHandler = { _ in
  print("swipe outside")
}

Forwarding tap gesture on dismiss

By default the "tap to dismiss" gesture recognizer cancels the taps in the view, you can enable this behaviour manually if needed:

popTip.tapToRemoveGestureRecognizer?.cancelsTouchesInView = false

Updating the PopTip

You can update the text, attributed text, or custom view to a PopTip already visible:

popTip.update(text: "New string")
popTip.update(attributedText: someAttributedString)
popTip.update(customView: someView)

The position can also be changed by updating the from property:

let here = CGRect(x: 100, 100, 10, 10)
let there = CGRect(x: 400, 400, 10, 10)

popTip.show(text: "Hey! Listen!", direction: .up, maxWidth: 200, in: view, from: here)
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
  popTip.from = there
}

Custom entrance animation

You can choose which animation should be performed when the popTip is displayed:

popTip.entranceAnimation = .scale;

Available animations:

PopTipEntranceAnimation.scale,
PopTipEntranceAnimation.transition,
PopTipEntranceAnimation.none,
PopTipEntranceAnimation.custom

PopTipEntranceAnimation.custom

You can provide your own animation block when using PopTipEntranceAnimation.custom:

popTip.entranceAnimationHandler = { [weak self] completion in
  guard let `self` = self else { return }
  self.popTip.transform = CGAffineTransform(rotationAngle: 0.3)
  UIView.animate(withDuration: 0.5, animations: {
    self.popTip.transform = .identity
  }, completion: { (_) in
    completion()
  })
}

This sample makes the PopTip rotate on entrance. Make sure to call the completion block when the animation is done. Also note that the animation is fired as soon as the PopTip is added as subview.

Action animations

Action animations are subtle animations that can be performed to get the user's attention. Set your preferred animation:

popTip.actionAnimation = .bounce()

Available animations:

PopTipActionAnimation.bounce,
PopTipActionAnimation.float,
PopTipActionAnimation.pulse,
PopTipActionAnimation.none

The animation is fired as soon as the popover enters the scene and completes its entrance animation, if startActionAnimationOnShow is set to true.

Customize the animations

You can pass a custom value as an associated value to customize the action animation:

popTip.actionAnimation = .bounce(16) // This will bounce for 16px instead of the default value

AMPopTip bounce

Customizing the arrow position

The arrow is centered by default, and moves to avoid the edge of the screen. You can manually change the offset from the center using the bubbleOffset property.

A note about subviews

The popover is presented inside the view provided in the in parameter. If this view is smaller than the resulting popover, to prevent clipping set clipsToBounds = false on the presenting view, and set constrainInContainerView = false to the pop tip instance. See #175 for more context.

Customization

Use the appearance proxy to customize the popover before creating the instance, or just use its public properties:

textColor = <#UIColor#>;
textAlignment = <#NSTextAlignment#>
bubbleColor = <#UIColor#>
bubbleLayerGenerator = <#(PopTip)->Void#>
borderColor = <#UIColor#>
borderWidth = <#CGFloat#>
cornerRadius = <#CGFloat#> // Popover's border radius
isRounded = <#Bool#> // If set to YES the radius will equal frame.height / 2
offset = <#CGFloat#> // Offset between the popover and the origin
font = <#UIFont#>
padding = <#CGFloat#>
edgeInsets = <#UIEdgeInsets#>
arrowSize = <#CGSize#>
animationIn = <#TimeInterval#>
animationOut = <#TimeInterval#>
delayIn = <#TimeInterval#>
delayOut = <#TimeInterval#>
entranceAnimation = <#PopTipEntranceAnimation#>
exitAnimation = <#PopTipExitAnimation#>
actionAnimation = <#PopTipActionAnimation#>
actionAnimationIn = <#TimeInterval#>
actionAnimationOut = <#TimeInterval#>
actionDelayIn = <#TimeInterval#>
actionDelayOut = <#TimeInterval#>
edgeMargin = <#CGFloat#>
bubbleOffset = <#CGFloat#> // Offset between the bubble and the origin
arrowOffset = <#CGFloat#> // Offset between the bubble center and the arrow
arrowRadius = <#CGFloat#>
shadowOpacity = <#Float#>
shadowRadius = <#Float#>
shadowOffset = <#CGSize#>
shadowColor = <#UIColor#>
maskColor = <#UIColor#>
shouldShowMask = <#Bool#>
shouldCutoutMask = <#Bool#>
cutoutPathGenerator = <#(CGRect)->UIBezierPath#>
constrainInContainerView = <#Bool#>

Background mask

A background mask can be applied to dim the background when the PopTip is active, this can be enabeld by setting the public property to true:

popTip.shouldShowMask = true

The color is set by the maskColor property (default is UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)):

popTip.maskColor = UIColor(red: 1, green: 0, blue: 0, alpha: 0.6)

Adding a cutout

A cutout can be applied to the background mask to allow the from view to be visible through the dimmed background. shouldShowMask must be true as well as shouldCutoutMask for this to work. The cutout path is supplied via a closure with a signature of (_ from: CGRect) -> UIBezierPath stored against public property cutoutPathGenerator. The closure will provide an argument which is the CGRect frame supplied to popTip.show(...).

The default generator add an 8 rounded rectangle around the from frame area which has 8 padding in the x and y directions, it is as follows but can be changed to whatever is desired:

popTip.cutoutPathGenerator = { from in
  UIBezierPath(roundedRect: from.insetBy(dx: -8, dy: -8), byRoundingCorners: .allCorners, cornerRadii: CGSize(width: 8, height: 8))
}

A seperate callback closure can be called on tapping the area defined by the cutoutPathGenerator provided both shouldShowMask and shouldCutoutMask are true, the closure is as follows:

popTip.tapCutoutHandler = { popTip in
  print("\(popTip) cutout tapped")
}

Custom bubble background

A custom CALayer can be used as the background for the PopTip bubble, this is supplied via a closure with a signauture of ((_ path: UIBezierPath) -> CALayer?)? stored against public property bubbleLayerGenerator. The closure will provide an argument which is the UIBezierPath that represents the draw path for the PopTip bubble and arrow.

If bubbleLayerGenerator is nil, then the bubbleColor will be used instead for a solid background fill. If bubbleLayerGenerator is not nil, then it will be used, providing it provides a valid CALayer, otherwise bubbleColor will be used as a solid color fallback. Example below:

popTip.bubbleLayerGenerator = { path in
  
  let gradient = CAGradientLayer()
  gradient.frame = path.bounds
  gradient.colors = [UIColor.black.withAlphaComponent(0.4).cgColor, UIColor.black.withAlphaComponent(0.3)]
  gradient.locations = [0, 1]
  gradient.startPoint = CGPoint(x: 0.5, y: 0.0)
  gradient.endPoint = CGPoint(x: 0.5, y: 1.0)
    
  let shapeMask = CAShapeLayer()
  shapeMask.path = path.cgPath
  gradient.mask = shapeMask
  
  return gradient
}

Author

Andrea Mazzini. I'm available for freelance work, feel free to contact me.

Want to support the development of these free libraries? Buy me a coffee ☕️ via Paypal.

Contributors

Thanks to everyone kind enough to submit a pull request.

MIT License

Copyright (c) 2017 Andrea Mazzini. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ampoptip's People

Contributors

adamc01 avatar andreamazz avatar bennol avatar bpollman avatar chrisvasselli avatar coeur avatar deronbrown avatar dukandar avatar felipowsky avatar grimlock257 avatar jaimeleonparada avatar jobinsjohn avatar kevin-hirsch avatar lucaslt89 avatar melsam avatar mikhail-stepkin avatar neda20 avatar pigigaldi avatar readmecritic avatar retsohuang avatar rgomesbr avatar rivera-ernesto avatar rserentill avatar sandeepbol avatar sarsonj avatar seitk avatar simdani avatar valeriomazzeo avatar younata avatar zdavison avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ampoptip's Issues

Rounded arrow

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:

screen shot 2015-05-05 at 13 49 02

tableView on popView can't respond touch.

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];

PopTip Pointing at the wrong position

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

CPU 100%

tip.actionAnimation = AMPopTipActionAnimationBounce;
After pop or push the ViewControll,CPU rapidly rises to 100%
snip20150609_3

When the Show customView layout cannot be used

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!

  • (void)layoutSubviews {
    [super layoutSubviews];
    [self setup];
    }
  • (void)setup {

}

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

Not Dimissable

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.

AMPopTip Doesn't work with XIB created CustomView set for this PopTip, All App hangs

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.

Not able to add a tap gesture to the popover

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!

Having problems using with swift

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)

Can't change position of currently displayed tip

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.

Nested Frames and UIStackView

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?

Use a barButtonItem as source

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?

Add a dismissHandler

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.

Visible check can not be trusted

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

Setting appearance properties crashes on iOS 7

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:'

inBlock and delay parameters

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.

Poptip arrow position

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

PopTips on Views with scroll

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

Problem with UICollectionView

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;
}

Different appearance animation / custom animation

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.

Feature: Add AMPopTipDirectionNone to center in view

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!

Bounce doesn't work in Swift

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 :)

Tip either doesn't display or displays in wrong spot

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 :)

Add prebuilt binary

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 :octocat:

Pop tip zero frame

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

Strange flashing behavior

This is an EXCELLENT library. It's exactly what I needed.
Quick issue: when rapidly adding/removing pops from my view, I'll get weird flashing above the point. Is this an animation issue? Forgive my ignorance, I'm a relatively new developer :)

Keep up the good work!

ezgif com-video-to-gif

Add Shadows

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.

Slather failing

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 😁

NavigationBarItemFrame

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.

Make it easier to handle screen orientation change

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?

Adding a header to a popover?

Firstly, thank you for this amazing library which is really helpful. Is there a possibility of adding a header to the popover? Something like this:
screen shot 2015-09-29 at 12 01 06 pm

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.