All Projects → mercadolibre → Mptopfloatingview

mercadolibre / Mptopfloatingview

Licence: other

MPTopFloatingView

Use this view to show new activities inside your app. Support iOS 7+.

Example

Demo

Usage

1. Import MPTopFloatingView class

#import <MPTopFloatingView/MPTopFloatingView.h>

2. Create an intance

self.newsView = [[MPTopFloatingView alloc] initTopFloatingViewWithDismissBlock:^(MPTopFloatingViewDismissCause cause) {
    if (cause == MPTopFloatingViewDismissCauseTap) {
        //View was tapped! Use this block to execute something..
    }
}];

Use one of this alternative initializer to customize the view

・More initializers
- (nonnull instancetype)initTopFloatingViewWithText:(nonnull NSString *)text color:(nonnull UIColor *)color icon:(nonnull UIImage *)icon dismissBlock:(MPTopFloatingViewDismissBlock)dismissBlock;
- (nonnull instancetype)initTopFloatingViewWithText:(nonnull NSString *)text color:(nonnull UIColor *)color timeToDismiss:(NSTimeInterval)timeToDismiss dismissBlock:(MPTopFloatingViewDismissBlock)dismissBlock;
- (nonnull instancetype)initTopFloatingViewWithText:(nonnull NSString *)text textFont:(nullable UIFont *)font textColor:(nullable UIColor *)textColor color:(nonnull UIColor *)color icon:(nonnull UIImage *)icon finalPosition:(float)finalPosition duration:(float)duration dismissBlock:(MPTopFloatingViewDismissBlock)dismissBlock;
- (nonnull instancetype)initTopFloatingViewWithText:(nonnull NSString *)text textFont:(nullable UIFont *)font textColor:(nullable UIColor *)textColor color:(nonnull UIColor *)color icon:(nonnull UIImage *)icon finalPosition:(float)finalPosition duration:(float)duration timeToDismiss:(NSTimeInterval)timeToDismiss dismissBlock:(MPTopFloatingViewDismissBlock)dismissBlock;

3. Include the view inside the hierarchy

[self.view addSubview:newsView];
// Setup contraints...

4. Use this method to start the animation

The parameter is the final state of the view after the animation

[newsView startAnimation:MPTopFloatingViewStatusAppear];

Author

Cristian Gibert

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].