Giter Site home page Giter Site logo

kevin-lyn / stpopuppreview Goto Github PK

View Code? Open in Web Editor NEW
202.0 10.0 30.0 69 KB

An alternative peek preview for non 3D Touch devices. Inspired by Instagram.

License: MIT License

Objective-C 97.11% Ruby 2.89%
ios popup ui ui-components iphone ipad force-touch

stpopuppreview's People

Contributors

jeffaburt avatar kevin-lyn 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

stpopuppreview's Issues

Bug with header

I am facing an erro using STPopupPreviedw with MXSegmentedPager

Actually, I have no idea this problem is related to MXSegmentedPager

In the blurred background view, the frame is incorrect

To see the error, please, see the video demo

- (UIViewController *)previewViewControllerForPopupPreviewRecognizer:(STPopupPreviewRecognizer *)popupPreviewRecognizer{
    if (![popupPreviewRecognizer.view isKindOfClass:[CellFuturePost_CollectionViewCell class]]) {
        return nil;
    }
    
    CellFuturePost_CollectionViewCell *cell = popupPreviewRecognizer.view;
    
    PreviewViewController *previewViewController = [self.storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([PreviewViewController class])];
    previewViewController.post = cell.post;
    return previewViewController;
}

- (UIViewController *)presentingViewControllerForPopupPreviewRecognizer:(STPopupPreviewRecognizer *)popupPreviewRecognizer{
    return self;
}

- (NSArray<STPopupPreviewAction *> *)previewActionsForPopupPreviewRecognizer:(STPopupPreviewRecognizer *)popupPreviewRecognizer{
    if (![popupPreviewRecognizer.view isKindOfClass:[CellFuturePost_CollectionViewCell class]]) {
        return nil;
    }
    CellFuturePost_CollectionViewCell *cell = popupPreviewRecognizer.view;
    STPopupPreviewAction * seePost = [STPopupPreviewAction actionWithTitle:@"Ver post" style:STPopupPreviewActionStyleDefault handler:^(STPopupPreviewAction *action, UIViewController *previewViewController) {
        [self.delegate openPost:cell.post];
    }];
    
    STPopupPreviewAction * like = [STPopupPreviewAction actionWithTitle:@"Like" style:STPopupPreviewActionStyleDefault handler:^(STPopupPreviewAction *action, UIViewController *previewViewController) {
        [self.delegate openLikes:cell.post];
    }];
    
    STPopupPreviewAction * comment = [STPopupPreviewAction actionWithTitle:@"Comment" style:STPopupPreviewActionStyleDefault handler:^(STPopupPreviewAction *action, UIViewController *previewViewController) {
        [self.delegate openComment:cell.post];
    }];
    return @[seePost, like, comment];
}

The error 'contentSizeInPopup should not be size zero'

// // ProfileViewController.h #import <UIKit/UIKit.h> #import <MBProgressHUD.h> #import <SDWebImage/UIImageView+WebCache.h> #import <STPopup/STPopup.h> @interface ProfileViewController : UIViewController<STPopupControllerTransitioning> @end
`
#import "ProfileViewController.h"

@interface ProfileViewController ()

@EnD

@implementation ProfileViewController

  • (void)viewDidLoad {
    [super viewDidLoad];

}

-(void)updateUserContactDetails:(NSString *)path Params:(NSDictionary *)params{

    STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"MobileUpdateOTP"]];
    popupController.style = STPopupStyleBottomSheet;
    [popupController presentInViewController:self];

}

#pragma mark - STPopupControllerTransitioning

  • (NSTimeInterval)popupControllerTransitionDuration:(STPopupControllerTransitioningContext *)context
    {
    return context.action == STPopupControllerTransitioningActionPresent ? 0.5 : 0.35;
    }

  • (void)popupControllerAnimateTransition:(STPopupControllerTransitioningContext *)context completion:(void (^)())completion
    {
    UIView *containerView = context.containerView;
    if (context.action == STPopupControllerTransitioningActionPresent) {
    containerView.transform = CGAffineTransformMakeTranslation(containerView.superview.bounds.size.width - containerView.frame.origin.x, 0);

      [UIView animateWithDuration:[self popupControllerTransitionDuration:context] delay:0 usingSpringWithDamping:1 initialSpringVelocity:1 options:UIViewAnimationOptionCurveEaseInOut animations:^{
          context.containerView.transform = CGAffineTransformIdentity;
      } completion:^(BOOL finished) {
          completion();
      }];
    

    }
    else {
    [UIView animateWithDuration:[self popupControllerTransitionDuration:context] delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
    containerView.transform = CGAffineTransformMakeTranslation(- 2 * (containerView.superview.bounds.size.width - containerView.frame.origin.x), 0);
    } completion:^(BOOL finished) {
    containerView.transform = CGAffineTransformIdentity;
    completion();
    }];
    }
    }

@EnD

#import <UIKit/UIKit.h>
#import <STPopup/STPopup.h>

@interface MobileUpdateOTPViewController : UIViewController

@EnD

#import "MobileUpdateOTPViewController.h"

@interface MobileUpdateOTPViewController ()

@EnD

@implementation MobileUpdateOTPViewController

  • (instancetype)init
    {
    if (self = [super init]) {
    self.title = @"Verification Code";
    self.contentSizeInPopup = CGSizeMake(300, 400);
    self.landscapeContentSizeInPopup = CGSizeMake(400, 200);
    }
    return self;
    }

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    }

  • (void)viewDidLayoutSubviews
    {
    [super viewDidLayoutSubviews];
    }

@EnD
`

I'm getting error

[STPopupController contentSizeOfTopView], ~/Pods/STPopup/STPopup/STPopupController.m:536
2017-06-07 17:40:48.249014+0530: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'contentSizeInPopup should not be size zero.'

Action Buttons and arrow not visible.

After compiling latest library 1.0.3 with latest xcode and do not longer see action buttons and arrow.

Tried to use xcode layout debugger and it responds that backgroundContentView size is 0,0 at position 0,0;
screen shot 2017-11-20 at 10 51 03 pm

Swift?

Hello, there is a swift example for this?

Thanks!!

Overlap Image with ActionSheet

Hi kevin,

The image is overlapping on ActionSheet, See the attached image.
This situation occurs when the image is not download from server and popup appears before it.
After downloading and setting up the image .. this happen,

CGFloat imageWidth = [self.data[@"dimensions"][@"width"] doubleValue];
CGFloat imageHeight = [self.data[@"dimensions"][@"height"] doubleValue];

the above 2 lines will not work until the image downloaded.
So need to set the UI again after image downloading.

img_2435

Expose long press gesture location

I've implemented 3d touch with a helper that receives the UICollectionView. From there I retrieve the pressed cell with the location from previewingContext:viewControllerForLocation:.

I'd like to add this popupPreviewRecognizer to the UICollectionView as well, but I need the gesture location for determining which cell was pressed.

3D Touch usage for iphone 6s and above

If i'm not mistaken, this library applies on iphone which doesn't have 3D touch. How about iphone 6S and above ? It does have 3D touch, can i use this library to preview my image? Or should i put different code applied for it's 3D touch function ?

change Blur background

Is it possible to change the Blur background? Can I use the same functions as STPopup?

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.