Git Product home page Git Product logo

stpopup's People

Contributors

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

stpopup's Issues

problem

Pop-up window slowly !!

Unbalanced calls to begin/end appearance transitions....

We have an application which is using STPopup and we are facing an issue that "Unbalanced calls to begin/end appearance transitions" starts appearing if following code executed by popup launched using STPopup. The code is part of UIViewController which was launched by STPopup. It doesn't happen if the same code executed from normal VC (non-popup). Any idea?

-(void) sendSMS:(NSString *)phone message:(NSString *)message {

MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];

if([MFMessageComposeViewController canSendText]) {

    controller.body = message;
    controller.recipients = [NSArray arrayWithObjects:phone, nil];

    controller.messageComposeDelegate = self;
    [self presentViewController:controller animated:YES completion:nil];
} 

}

UISearchBar not repositioning in popup when keyboard is dismissed on searchBarSearchButtonClicked:

Hi, I have a problem and was hoping, you guys could help.

I'm using the popup to present a UIViewController containing a UITableView. On viewDidLoad I am instantiating a UISearchController and assigning the searchBar view to the tableView's tableHeaderView property.

This all works great until I tap on the search button. In this case, the searchBar remains in situ while the rest shifts down as usual (see video link below). Is there a way to fix this?

https://goo.gl/f1x6V1

Thanks!

Is possible to change size of popupcontroller?

Is possible to change the size of the popup controller when is showed in the view?
I want to resize it when the keyboard is active.
I tried with this code

self.view.frame = CGRectMake(0, 0, self.view.bounds.width, 100)

but it doesn't work.

self.popupController is NULL after presenting MFMessageComposeViewController

We fire up a text message composer from clicking on one of the tableview cells. After dismissing it with [self dismissViewControllerAnimated:completion:] the next time you click on one of the cells, self.popupController is NULL and we can no longer dismiss the controller with [self.popupController dismiss].

More TransitionStyle

For example STPopupTransitionStyleSlideVerticalUP or STPopupTransitionStyleSlideVerticalDown

Orientation issue

replication steps:

  1. tap the bottom sheet style in portrait
  2. when the sheet is loaded rotate simulator. The sheet will show like this:

screen1

  1. close the sheet while in landscape mode and reopen it. You will see that it takes the whole width now.
  2. if you rotate the simulator now you will see that the sheet will be shown like this:
    screen2

Close popup when clicking outside of the controller

Hi Kevin,

I would like to know if there is an easy way to make the popup close when clicking outside of the view.
I saw there is already something to drag the popup down that make it close, but nothing when clicking outside. I tried couple things but it didn't work well.

Do you know if there is a way to do that?

Thanks,
Ben

Ton of Crashes

Hey! We got like 120 crashes on this line:

UIResponder+STPopup.m line 35
-[UIResponder(STPopup) st_becomeFirstResponder]

Any ideas whats going on? Thanks Kevin!

Issue while running tests with STPopup

After adding STPopup to my app, I am unable to run tests properly. I seem to be getting a stack overflow with a recursive function call to st_parentViewController, here:

- (UIViewController *)st_parentViewController
{
    if (!self.popupController) {
        return [self st_parentViewController];
    }
    return [[self.popupController valueForKey:@"containerViewController"] parentViewController];
}

screen shot 2015-09-21 at 7 08 01 pm

I'm scratching my head trying to figure out why this is happening, but right now unable to test when the library is included. The library works perfectly in the app. Any help would be great!

Dismiss view.

How can i dismiss the popup by a button action.
using the same transition style.

Call notification after dismiss

Hi there,

I want to make a NSNotificationCenter when popup is dismiss but it isn't work.

First I using NSNotificationCenter to register login_success event.

[[NSNotificationCenter defaultCenter] postNotificationName:@"login_success" object:nil];
[self.popupController dismiss];

And then I call it in parent view.

  • (void)viewDidAppear:(BOOL)animated
    {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chot_so_login_success) name:@"chot_so_login_success" object:nil];
    }

But nothing happen, how can I handler event after popup closed?

Thanks for help

Any callback method when the popup is closed?

I tried the following:

 [popupController presentInViewController:self completion:^{
    NSLog(@"Dismissed!");
}];

But this only works when the popup is finished appearing on the screen. I hope there must be some method somewhere but i just couldn't find it.

Please advice, thx!

Adding an display offset

Would be great to have the option to display the view controller at an offset - I'm trying to have it closer to the bottom of the screen. Thanks!

How use it for full screen presentation?

Hi guys,

The main goal is to present my first viewController looking like a "classic" modal, and detail controllers pushed inside will be smaller.

I tried to set contentSizeInPopup with UIScreen bounds dimension and set transition with a full screen presentation, but it didn't work.

Is there anyway to do that in a proper way?

Thanks,
Ben

considering in-call status bar frame changes

First of all Great Lib and now it will be a part of my default Pods

All things are great just one thing and it might not be an issue with Lib because i have not explore the lib that much.

Issue or suggestion

considering in-call status bar frame changes

Now i am setting the height of contentSizeInPopup in this way and it works awesome with dynamic height

override func viewDidLoad() {
        super.viewDidLoad()
        self.tableView.addObserver(self, forKeyPath: "contentSize", options: NSKeyValueObservingOptions.New, context: nil)
        self.contentSizeInPopup = CGSizeMake(UIScreen().bounds.width, self.tableView.contentSize.height ?? 200)

  }

    override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
        guard let _ = self.tableView else {
            return
        }
        self.contentSizeInPopup = CGSizeMake(UIScreen().bounds.width, self.tableView.contentSize.height ?? 200)

    } 

But during the in-call status bar where the size of status bar increased with 40px, At that time popup got shifts down with 20px and was not able to scroll to the bottom of the last cell. so what is the better way to handle this ? any help, Thanks in advanced.

Set contentSizeInPopup size with constraints.

Hi @kevin0571 , fantastic utility!

I wonder if I can set contentSizeInPopup size with autolayout constraints in ViewController (In storyboard or just programmatically) ?
Trying to set the contentSizeInPopup size depending on UIView x,y,width,height or subviews reminds me of the times when we had to do without autolayout. That is what I really don't wanna deal with :)

I see the example project, where there is a scenes with freeform sizes, which doesn't stretches as subviews' bounds changes.

Thank you!

Time for transitions

Would be awesome if we can specify a time for the transition and have the option to do no transition!

Recognizing tap right after dismiss

Another question - after I dismiss the modal, the next tap (if I tap quickly) isn't registered by the main view controller. Any thoughts on how to fix this? Thanks!

failed to run the example

I just can't make example run even I have added STPopup.framework to example project, I still hit the error "dyld: Library not loaded: @rpath/STPopup.framework/STPopup
Referenced from: /var/mobile/Containers/Bundle/Application/AB81B362-72D7-4305-8F42-C1AEEE1C0F49/STPopup.app/STPopup
Reason: image not found"

Why is that ?

Adding gesture recognizer to dismiss on background tap will cause dismissal if popup is tapped during a transition

Sorry, that was hard to say concisely in title.

If you add a gesture recognizer to the background as described in the readme like this:

Dismiss popup when tapping background
popupController = [[STPopupController alloc] initWithRootViewController:self];
[popupController.backgroundView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundViewDidTap)]];

the view can be dismissed by tapping anywhere during a transition. It appears that the animation when pushing a new controller is letting taps on the popup interface make it to the background and trigger the gesture recognizer. So if you add the recognizer, push a new view, and then tap somewhere on that view the whole popup will dismiss.

I suppose a remedy would be to add and remove the recognizer when transitioning, but you'd have to do it on every subsequent controller in the nav hierarchy, which would be kind of annoying.

UINavigationBar items not appearing

enablepush

I am loading the view controller from a storyboard and STPopup Controller is instantiated here
let storyboardID = UIStoryboard(name: "Push", bundle: nil) let popupController: STPopupController = STPopupController(rootViewController: storyboardID.instantiateViewControllerWithIdentifier("enablePush")) popupController.containerView.layer.cornerRadius = 4 popupController.presentInViewController(self)

In viewDidLoad() of this view controller I have:

self.contentSizeInPopup = CGSizeMake(300, 200) self.landscapeContentSizeInPopup = CGSizeMake(400, 200) self.navigationItem.rightBarButtonItem?.image = UIImage(named: "dismissPushIcon") self.navigationItem.title = "Enable Push"

However the navigation bar remains empty as in the picture above.

Help : Present Multiple STPopup at sametime

I am using UILocalnotification...on receiving the notification i open STPopup when the app is in active mode...but if multiple notifications are received at same time...how do i open the multiple popup...above each other and dismiss them sequentially....I tried opening viewcontroller but receiving this error Warning: Attempt to present <NotificationViewController: 0x7fc033b43900> on <UINavigationController: 0x7fc031859600> whose view is not in the window hierarchy!

Thanks

Tap Background To Dismiss

Hey! Awesome library! Thanks for making it!!!

Two quick questions:

  1. How did you get the rounded corners in the demo page?
  2. Can you tap on the background to dismiss the modal?

Thanks again!

navigationItem.titleView is not shown after presenting

Reproduce:

  1. InPopupViewController1.m , set titleView in viewDidLoad

    self.navigationItem.titleView = [UIButton buttonWithType:UIButtonTypeInfoLight];
    
  2. Build and run the example project, tap the first row on the table view. You can see that the titleView is not shown.

  3. Now tap the "Next" bar item on the opened view controller, and then tap the "Back" arrow, now you can see that the titleView is shown.

I found this bug on my iPhone 6 Plus which installed iOS 8.4, I also tested in iPhone Simulator 9.0/9.1/9.2 and it worked fine.

After debugging, I found that the titleView was removed from popupController's navigationBar after presenting popupController. This is so strange. Maybe it is an iOS bug.

Temporary Fix:

Re-add titleView to navigationBar when viewDidAppear, or reset navigationItem.titleView:

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    // BugFix: navigationBar's titleView is not shown after presenting STPopupController.
    // See: https://github.com/kevin0571/STPopup/issues/60
    if (self.popupController) {
        UIView *titleView = self.popupController.navigationBar.topItem.titleView;
        if (titleView && !titleView.superview) {
            // Re-add titleView to the navigationBar
            // [self.popupController.navigationBar addSubview:titleView];

            // Or: invoke -[STPopupController updateNavigationBarAniamted]
            self.navigationItem.titleView = titleView;
        }
    }
}

Crash when dismissing a modal QLPreviewController in iOS8 (ipad)

Basically, present a QLPreviewController modally in iOS8 and crash when user dismisses it.

Traced to swizzle st_parentViewController.

I 'fixed' it by doing this in UIViewController+STPopup.m (but maybe there's a better way?):

  • (UIViewController *)st_parentViewController
    {
    @Try {
    if (!self.popupController) {
    return [self st_parentViewController];
    }
    }
    @catch (NSException *exception) {

    }
    @finally {
    return [[self.popupController valueForKey:@"containerViewController"] parentViewController];
    }
    }

That was a hard one to find:)

Presenting STPopup for modal controller (iPad)

Hi.
When I tried to present STPopupController from view controller with modal presentation style UIModalPresentationFormSheet, I got wrong frames for STPopup content controller.

simulator screen shot 22 2015 16 13 34

I think the problem is here:

- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext
{
    UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
    UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];

    toViewController.view.frame = fromViewController.view.frame;

Why are you changing toViewController.view.frame?

Thanks

Drop shadow

Hey, I love your popup lib. I use it in a project of mine and it works great. However, I cannot seem to figure out how to add a drop shadow to the popup. Is that possible or would it require a lot of hacks?

Transparent Navigation Bar

Is it possible to make navigation bar inside popup fully transparent ? I tried to use methods, that are used to set up transparency for global navigation bar, but they don't work.

Also I tried UIColor.clearColor, but it turns the navigation bar to black color

Enable to hide navigation bar

I saw the issue #5 where it says the support to hide a navigation bar is added. But, when I try to hide it using the code below, it crashes.

CustomViewController *viewController = [[CustomViewController alloc] init];
STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:viewController];
popupController.navigationBarHidden = YES; // Crashes

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'contentSizeInPopup should not be size zero.'

I set both "contentSizeInPopup" and "landscapeContentSizeInPopup" properly. Because, when I remove the line where there is a code to hide a navigation bar, it works.

Carthage Support

Enjoying this library. Was hoping for Carthage support since I cannot use cocoapods due to limitations.

Add the completed callback, when the popup is closed by touching

Hello.
Add the completed callback, when the popup is closed by touching
- (void)popupNavigationBar:(STPopupNavigationBar *)navigationBar touchDidEndWithOffset:(CGFloat)offset { if (offset > 150) { STPopupTransitionStyle transitionStyle = self.transitionStyle; self.transitionStyle = STPopupTransitionStyleSlideVertical; [self dismissWithCompletion:^{ self.transitionStyle = transitionStyle; ** self.completed();** }]; }
Thx

Adjust top position

Hi there,

I would like to Adjust top margin because I have ADS banner at bottom, so if I adjust height to see ads then my popup view is too low.

I've been trying to add CGrectMake but doesn't work.

Secondly, I want to make close button position X to right instead of left.

Thanks

HideNavigation Bar

How can i Hide the Navigation Bar?
I did
[STPopupNavigationBar appearance].hidden = YES;

with no success.Plz help.

Presenting modal breaks back button

Right now, I've got a table view inside a bottom sheet style pop up and I am attempting to display a Google Maps Autocomplete VC like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    GMSAutocompleteViewController *gmsVC = [GMSAutocompleteViewController new];
    gmsVC.delegate = self;
    gmsVC.autocompleteBounds = [self getBoundsForLocation];
    [self presentViewController:gmsVC animated:YES completion:nil];
}

When the gmsVC delegate method for completion/cancellation is called I dismiss the gmsVC as such:

- (void)wasCancelled:(GMSAutocompleteViewController *)viewController
{
    [self dismissViewControllerAnimated:viewController completion:nil];
}

After that, the back button never works again!

Dismiss animation use spring is not good way

I found the spring animation although it seems has been complete but did not actually complete

detail see gif

spring animation

2016-03-03 16_32_41

normal animation

[UIView animateWithDuration:[self transitionDuration:transitionContext] - 0.3 delay:0 options:UIViewAnimationOptionCurveEaseOut

2016-03-03 16_36_35

Add all relevant UINavigationController functionality

STPopupController is supposed to work just like a UINavigationController. Currently, it only supports pushViewController: animated: completion: and popViewControllerAnimated:.

I'd like to propose the following UINavigationController functionality be implemented:

  • topViewController (Implemented in PR #43)
  • popViewControllerAnimated should return the popped controller
  • popToViewController: animated
  • popToRootViewControllerAnimated
  • viewControllers
    • Make property public
    • Make property editable - (Rejected)
    • setViewControllers: animated: - (Rejected)
  • UIToolbar functionality
    • Toolbar should respect UIViewController's toolbarItems
    • toolbarHidden property
    • setToolbarHidden: animated:
  • delegate that has methods mirroring `UINavigationControllerDelegate

I'd be happy to assist in implementing some of these features, but I wanted to open up discussion on them first.

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.