nme

NMEasyTipView

Objective-C alternative for EasyTipView implemented in swift

Showing:

Popularity

Downloads/wk

0

GitHub Stars

195

Maintenance

Last Commit

3yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

EasyTipView: fully customisable tooltip view written in Swift

Description

EasyTipView is a fully customisable support for EasyTipView written in Swift. (https://github.com/teodorpatras/EasyTipView)

Contents

  1. Features
  2. Installation
  3. Usage
  4. Customising the appearance
  5. Customising the presentation and dismissal animations
  6. Public interface

## Features

  • Can be shown pointing to any UIBarItem or UIView subclass.
  • support for any arrow direction ←, →, ↑, ↓
  • Automatic orientation change adjustments.
  • Fully customisable appearance.
  • Fully customisable presentation and dismissal animations.

Installation

Manually

Drag drop Source folder in your project

Pods

To integrate EasyTipView into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'NMEasyTipView', '~> 1.2'

Then, run the following command:

$ pod install

Usage

1) First you should customize the preferences:


    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(50, 100, 100, 50);
    [button setTitle:@"Click Me" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self.view addSubview:button];
    
    
    [button addTarget:self action:@selector(handle:) forControlEvents:UIControlEventTouchUpInside];
    
    RCEasyTipPreferences *preferences = [[RCEasyTipPreferences alloc] initWithDefaultPreferences];
    preferences.drawing.backgroundColor = [UIColor purpleColor];
    preferences.drawing.arrowPostion = Top;
    preferences.animating.showDuration = 1.5;
    preferences.animating.dismissDuration = 1.5;
    preferences.animating.dismissTransform = CGAffineTransformMakeTranslation(0, -15);
    preferences.animating.showInitialTransform = CGAffineTransformMakeTranslation(0, -15);
    
    RCEasyTipView *tipView = [[RCEasyTipView alloc] initWithPreferences:preferences];
    tipView.text = @"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";
    [tipView showAnimated:YES forView:button withinSuperView:self.view];

Customising the appearance In order to customise the EasyTipView appearance and behaviour, you can play with the Preferences structure which encapsulates all the customizable properties of the EasyTipView. These preferences have been split into three structures:

  • Drawing - encapsulates customisable properties specifying how EastTipView will be drawn on screen.
  • Positioning - encapsulates customisable properties specifying where EasyTipView will be drawn within its own bounds.
  • Animating - encapsulates customisable properties specifying how EasyTipView will animate on and off screen.
Drawing attributeDescription
cornerRadiusThe corner radius of the tip view bubble.
arrowHeightThe height of the arrow positioned at the top or bottom of the bubble.
arrowWidthThe width of the above mentioned arrow.
foregroundColorThe text color.
backgroundColorThe background color of the bubble.
arrowPositionThe position of the arrow. This can be:
+ Top: on top of the bubble
+ Bottom: at the bottom of the bubble.
+ Left: on the left of the bubble
+ Right: on the right of the bubble
+ Any: use this option to let the EasyTipView automatically find the best arrow position.
If the passed in arrow cannot be applied due to layout restrictions, a different arrow position will be automatically assigned.
textAlignmentThe alignment of the text.
borderWidthWidth of the optional border to be applied on the bubble.
borderColorColor of the optional border to be applied on the bubble. In order for the border to be applied, borderColor needs to be different that [UIColor clear] and borderWidth > 0
fontFont to be applied on the text.
Positioning attributeDescription
bubbleHInsetHorizontal bubble inset witin its container.
bubbleVInsetVertical bubble inset within its container.
textHInsetText horizontal inset within the bubble.
textVInsetText vertical inset within the bubble.
maxWidthMax bubble width.
Animating attributeDescription
dismissTransformCGAffineTransform specifying how the bubble will be dismissed.
showInitialTransformCGAffineTransform specifying the initial transform to be applied on the bubble before it is animated on screen.
showFinalTransformCGAffineTransform specifying how the bubble will be animated on screen.
springDampingSpring animation damping.
springVelocitySpring animation velocity.
showInitialAlphaInitial alpha to be applied on the tip view before it is animated on screen.
dismissFinalAlphaThe alpha to be applied on the tip view when it is animating off screen.
showDurationShow animation duration.
dismissDurationDismiss animation duration.

Customising the presentation or dismissal animations

The default animations for showing or dismissing are scale up and down. If you want to change the default behaviour, you need to change the attributes of the animating property within the preferences. An example could be:

preferences.drawing.arrowPostion = Top;
preferences.animating.showDuration = 1.5;
preferences.animating.dismissDuration = 1.5;
preferences.animating.dismissTransform = CGAffineTransformMakeTranslation(0, -15);
preferences.animating.showInitialTransform = CGAffineTransformMakeTranslation(0, -15);

This produces the following animations:

Public interface

#Delegate EasyTipViewDelegate is a custom protocol which defines one method to be called on the delegate after the EasyTipView has been dismissed.


@protocol RCEasyTipViewDelegate <NSObject>
@optional

- (void)willShowTip:(RCEasyTipView *)tipView;
- (void)didShowTip:(RCEasyTipView *)tipView;

- (void)willDismissTip:(RCEasyTipView *)tipView;
- (void)didDismissTip:(RCEasyTipView *)tipView;

@end

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100