Giter Club home page Giter Club logo

mjpopupviewcontroller's Introduction

MJPopupViewController (deprecated)

A UIViewController Category to display a ViewController as a popup with different transition effects.

Written by Martin Juhasz, June 2012.

Note: You should no longer use this category since it's outdated and there are more modern approaches for facing this problem.

Installation

Just drop the files under Source into your Xcode project. Also you need to add the QuartzCore-Framework to your project.

Usage

First you have to import the category

#import "UIViewController+MJPopupViewController.h"

then simply use presentPopupViewController:animationType, f.e.:

[self presentPopupViewController:detailViewController animationType:MJPopupViewAnimationFade];

to dismiss the popup, use dismissPopupViewControllerWithanimationType

[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];

see the demo for more detailed examples

Demo

You can open the MJPopupViewControllerDemo demo project in Xcode and run it on your iPhone as well as in the Simulator.

Issues and Feature Requests

Please report issues via GitHub's issue tracker.

ARC

This version is made using Automated Reference Counting.

TODO

  • Rotation Support
  • More animation types
  • support different background types

mjpopupviewcontroller's People

Contributors

chocochipset avatar ciphercom avatar martinjuhasz avatar matsu911 avatar siddhanth avatar simonbs avatar surajnalin2024 avatar viking2009 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

mjpopupviewcontroller's Issues

Popup over modal view controller in iOS 4.3

I love MJPopupViewController, but today i found some problem.

I need to open popup over modal view controller. It works fine in iOS 5.1 but popup never shows over such view controller in iOS 4.3. I've created sample application to demonstrate problem: http://www.sendspace.com/file/53zadp

Simply chose iPad 5.0 / 5.1 Simulator and click two buttons (first button will show modal view controller, second will show Popup over it). Then try to do this on iPad 4.3 Simulator. Second button doesn't work :(

Any suggestions?

Button for send emails

I'm having some trouble to send email from a button in the popup. The button calls the mail compose view, but when i touch the "cancel button", the view doesn't dismiss.

About viewDidAppear method

When popup with a UIViewContrller,viewDidAppear can be executed twice.When I see the sourcecode like this

[UIView animateWithDuration:kPopupModalAnimationDuration animations:^{
[self.mj_popupViewController viewWillAppear:NO];
self.mj_popupBackgroundView.alpha = 0.5f;
popupView.alpha = 1.0f;
} completion:^(BOOL finished) {
[self.mj_popupViewController viewDidAppear:NO];
}];

why in completion "[self.mj_popupViewController viewDidAppear:NO];" can be call

How to update the background View

If I perform an action on the popupView, how do I update it in the background View.

For example- if I press a button in popupView to change UILabel text in the background, how do I update the background View without closing the popup or how do I check if popup has been closed so that the background view can be updated.

how free memory when popup is dismissed

Hello, i display a UIView in your amazing MJPopup and when the view is open the memory increase of 25MB, and it's ok because it's a complex view with a lot of subviews, but when i dismiss the MJPopup the memory doesn't free, but remain of that value, how i can release it?

Background Blur Effect

Instead of having a alpha change for the background, it would be great to have a blur effect instead.

I've tried replacing the background view, but this had no effect.

I wish I'd posted here at the time, as I would have been able to remember exactly what happened. But I can't remember having any errors or warnings, just that it ignored my replacement background view class.

Can you offer any guidance on this?

My issue is that I have buttons on my parent view and simply applying a darkening effect doesn't make the parent buttons look disabled. The style of my app doesn't suit the darkening effect either.

Multiple Popovers?

I'm trying to have multiple popovers, and it works, except when I dismiss the popover, the first popover dismisses itself instead of the second one on top. Any suggestions?

Close popup from popup

Hi all,

I inserted close button into my popup. Handlet action is:

UIViewController *parent = [self parentViewController];
[parent dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];

but popup is not close.

Is it possible it?

Thanks

PopUpView add an button

Could we add a button on popUpView add link to an action.
I tried to do so, but bad access show

Using twice with different results

I'm using this popup as a cancel confirmation when someone taps the close button.

However, I'd like to use a second time, for when someone taps the back button.

But I need to do different things depending on which.

I did think I could simple set a tag, but I 23942 back, not sure why.

Any suggestions?

UIViewController+MJPopupViewController.m line 349 __78-[UIViewController(MJPopupViewController) fadeViewOut:sourceView:overlayView:]_block_invoke137

Hi

I'm getting the follow crash. Is there a fix for this ?

Thanks

UIViewController+MJPopupViewController.m line 349
__78-[UIViewController(MJPopupViewController) fadeViewOut:sourceView:overlayView:]_block_invoke137

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x2000000c

Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x3b3a7b66 objc_msgSend + 5
1 UIKit 0x338f3ff5 -[UITextField _shouldEndEditing] + 72
2 UIKit 0x338f3fa9 -[UITextField canResignFirstResponder] + 20
3 UIKit 0x3387867d -[UIResponder resignFirstResponder] + 68
4 UIKit 0x338f3ea5 -[UITextField resignFirstResponder] + 128
5 UIKit 0x338eb455 -[UIView(Hierarchy) _removeFirstResponderFromSubtree] + 180
6 UIKit 0x33a698c3 __UIViewWillBeRemovedFromSuperview + 70
7 UIKit 0x337d2091 -[UIView(Hierarchy) removeFromSuperview] + 56
8 My App 0x000fd743 __78-[UIViewController(MJPopupViewController) fadeViewOut:sourceView:overlayView:]_block_invoke137 (UIViewController+MJPopupViewController.m:349)
9 UIKit 0x3380be6d -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 284
10 UIKit 0x3380bab7 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
11 UIKit 0x3380b9cf -[UIViewAnimationState animationDidStop:finished:] + 66
12 QuartzCore 0x33461413 CA::Layer::run_animation_callbacks(void*) + 234
13 libdispatch.dylib 0x3b8910af _dispatch_client_callout + 22
14 libdispatch.dylib 0x3b8939a9 _dispatch_main_queue_callback_4CF + 268
15 CoreFoundation 0x3101a5b1 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 8
16 CoreFoundation 0x31018e7d __CFRunLoopRun + 1308
17 CoreFoundation 0x30f83471 CFRunLoopRunSpecific + 524
18 CoreFoundation 0x30f83253 CFRunLoopRunInMode + 106
19 GraphicsServices 0x35cbd2eb GSEventRunModal + 138
20 UIKit 0x33838845 UIApplicationMain + 1136
21 My App 0x000d7083 main (main.m:14)

Background persists even with UI colour of 0.0, 0.0, 0.0,0.0

Hi there,

I'm trying to get the popup to show rounded corners, and have a graphic to use with a UI Image and simply create a UIColour with 0 alpha and set the background of the popup to this colour in MJDetailViewController. However I'm still getting a shadow with square edges when I do this.

Code is simply:
backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0];
self.view.backgroundColor = backgroundColor;
Screen Shot 2013-03-27 at 16 22 46

Adding UIDatePicker

Hi Guys, I've been trying this control and love it! I was just wondering if we can embed UIDatePicker in it, so user can pick a date and close it using a button.

Any help would be appreciate it.

awesome control

This control is super simple and easy to use. Im preparing in my fork a couple of updates:

  1. Add the popup as a child VC so we can access the parent VC.
  2. Add more animations or add custom animation support to add even more
  3. Fix the background view to be similar to iOS 7

shadow does not follow corners

fix:
popupView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:popupView.bounds cornerRadius:popupView.layer.cornerRadius].CGPath;

get navigation controller from popup

Hi all, I need to get popup parent navigation controller and push in other controller... example:

VC1 open VC2 as popup
VC1.navController presentPopup (VC2)

VC2 open VC3
VC1.navController presentPopup (VC2) //how I get VC1 (parent) navController?

Thanks

Luca

MJPopoverViewControllerDemo errors on initial launch

I'm encountering this error messages:

Automatic Reference Counting Issue

  • Receiver type 'UIViewController' for instance message does not declare a method with selector 'presentPopupView:animationType:'

Automatic Reference Counting Issue

  • Receiver type 'UIViewController' for instance message does not declare a method with selector 'slideViewOut:sourceView:overlayView:withAnimationType:'

Automatic Reference Counting Issue

  • Receiver type 'UIViewController' for instance message does not declare a method with selector 'fadeViewOut:sourceView:overlayView:'

Automatic Reference Counting Issue

  • Receiver type 'UIViewController' for instance message does not declare a method with selector 'slideViewIn:sourceView.overlayView:withAnimationType:'

Automatic Reference Counting Issue

  • Receiver type 'UIViewController' for instance message does not declare a method with selector 'fadeViewIn:sourceView:overlayView:'

and a warning message:

Semantic issue

  • Enumeration value'MJPopupViewAnimatiobnFade' not handled in switch

Any idea on how to fix this issues on the demo project included in the zip file? Thanks!

Popup view is not centered

Hi there, first of all thanks a lot for this beautiful easy handy code. Your code is working fine for me, however I just found an issue with that, "I know what I'm doing and checked in your code as well, there's no issue with code", but issue is due to my requirement.

Here's my view description in which I'm showing up popup with your controller.

UIView: 0x8dd1190; frame = (0 0; 320 559); autoresize = H; layer = <CALayer: 0x8df0200

Please note, it's not an iPhone5, its iPhone4 view, which will resize based on content I'll have available.

Whole view is inside UIScrollView, and I've to scroll to go down. When I tap on a button, I'm showing popup but not in centered due to size of the view.

You make it general so that it'll be helpful to large no of people.

Can you give me a hint or a patch, where I can make a change in your category class that work for me in this case.

In category class,

  • (void)presentPopupView:(UIView*)popupView animationType:(MJPopupViewAnimation)animationType dismissed:(void(^)(void))dismissed {}

I made a small change in first line,

UIView *sourceView = [self topView];
sourceView.frame = CGRectMake(0, 0, 320, 416);

so it worked in one case, but then again it'll not centered when I scroll down and load the popup, I also thinking that its wrong and improper way.

Waiting for your reply.

Background alpha customize

Hi,
First, thanks slot for awesome project.

How can i control the alpha for the background viewController?

10x in advance!

sending data from DetailViewController to MasterViewController

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *)indexPath {
    WizardViewController *mj = [[WizardViewController alloc] initWithNibName:@"WizardViewController" bundle:nil];
    mj.countryselected = [countryNames objectAtIndex:indexPath.row];
    [mj.countryButton setTitle:mj.countryselected forState:UIControlStateNormal];
    [self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
}

DetailViewController is dismissing but countryButtonTitle is not updating. Any help ?

Press close button- still show fade background

Hi,

When i invoke:
[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
From my popup, the popup dismiss, but the background ViewController still fade.

How can i fix it?

10x in advance!

Ran

multiple view in single popup.

Hi i m use your library in many projects first thanks for share this .
in my recent project i m facing one problem on button click i m open one view name "First view controller" in mjpopup and in this view i have one button on click of that button i m open another view name "Second view controller". the problem is that when open secondviewcontroller i wann disappear firstviewcontroller. can u guide me how to achive this task ??
thanks

viewDidDisappear not being called

Firstly, thanks very much for this great library. I found out that viewDidDisappear is not triggered because self.mj_popupViewController get set to nil before animation completion callback happens.

Getting rid of the
self.mj_popupViewController = nil
in the dismissPopupViewControllerWithanimationType method solves the problem for me

margin for popup

CGRect popupEndRect = CGRectMake((sourceSize.width - popupSize.width) / 2,
170,
popupSize.width,
popupSize.height);

Popup view is not centered

Hi there, first of all thanks a lot for this beautiful easy handy code. Your code is working fine for me, however I just found an issue with that, "I know what I'm doing and checked in your code as well, there's no issue with code", but issue is due to my requirement.

Here's my view description in which I'm showing up popup with your controller.

<UIView: 0x8dd1190; frame = (0 0; 320 559); autoresize = H; layer = <CALayer: 0x8df0200>>

Please note, it's not an iPhone5, its iPhone4 view, which will resize based on content I'll have available.

Whole view is inside UIScrollView, and I've to scroll to go down. When I tap on a button, I'm showing popup but not in centered due to size of the view.

You make it general so that it'll be helpful to large no of people.

Can you give me a hint or a patch, where I can make a change in your category class that work for me in this case.

In category class,

  • (void)presentPopupView:(UIView*)popupView animationType:(MJPopupViewAnimation)animationType dismissed:(void(^)(void))dismissed {}

I made a small change in first line,

UIView *sourceView = [self topView];
sourceView.frame = CGRectMake(0, 0, 320, 416);

so it worked in one case, but then again it'll not centered when I scroll down and load the popup, I also thinking that its wrong and improper way.

Waiting for your reply.

Present UIView instead of UIViewController

I like what you've done here, but is there any reason why you're presenting a UIViewController instead of a UIView?

It seems a bit unnecessary to use a UIViewController (although I may well be missing the reason entirely). The code is easily convertible to use a UIView - I'm happy to submit my version if you'd like.

some times crashed when dismiss

- (void)fadeViewOut:(UIView*)popupView sourceView:(UIView*)sourceView overlayView:(UIView*)overlayView
{
    [UIView animateWithDuration:kPopupModalAnimationDuration animations:^{
        [self.mj_popupViewController viewWillDisappear:NO];
        self.mj_popupBackgroundView.alpha = 0.0f;
        popupView.alpha = 0.0f;
    } completion:^(BOOL finished) {
        [popupView removeFromSuperview];
        [overlayView removeFromSuperview];
        [self.mj_popupViewController viewDidDisappear:NO];
        self.mj_popupViewController = nil;
    }];
}

it shows on line

[popupView removeFromSuperview];

it happens occasionally :(

transition between popups

Hello, I'm having this problem while trying to make a transition between two different popups:

UIViewControllerHierarchyInconsistency’, reason: ‘child view controller: should have parent view controller:MyNavigationController but actual parent is: FirstViewController’

now I'm adding both the 2 popups as child in the "firstViewController" (which is the first shown and basic viewController of my app), just because I know that two VC needs to have a common parent to use the transition method, this is how I always did.

But I got that error and I'm not sure on how to solve it and why it is appearing, so if I want a button inside the popup that once clicked it shows another popup usin a flip animation, how could I do?

any help and advise would be appreciated, thanks

Blank popover view is getting displayed

I haved added 4 files from the source directory and imported "UIViewController+MJPopupViewController.h",

and when i use the below code

UIViewController *popupView = [[UIViewController alloc] init];
SampleView *sampleView = [[SampleView alloc] init];
[[popupView view] addSubview:sampleView];
[self presentPopupViewController:popupView animationType:MJPopupViewAnimationFade];

I have created a seperate SampleView file, which is just UIView and not UIView Controller. When i run the code, it simply displays blank transparent popup but other animations seems to be working fine.

And i also tried the sample demo application, i was not able to change any uiview controls dynamically?

What am i doing wrong?

Callback after dismiss

Is there anyway I can force the original View Controller to refresh once the pop up is closed.

I want to use it for In-App Purchases but need to it refresh the View Controller once the pop up is closed to check if any In-App Purchases have been made and make the required changes?

UITextfield in MJPop

When I have a textfield in the Pop, the keyboard will block my MJPop, how can i make it move up automatically ?

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.