martinjuhasz / mjpopupviewcontroller Goto Github PK
View Code? Open in Web Editor NEWA UIViewController Category to display a ViewController as a popup with different transition effects.
License: MIT License
A UIViewController Category to display a ViewController as a popup with different transition effects.
License: MIT License
I may be wrong but i have found that presentPopupViewController: doesn't work when the UIViewController is not self.
Hi,
First, thanks slot for awesome project.
How can i control the alpha for the background viewController?
10x in advance!
I'm dismissing the VC from a button inside the ViewController being presented and the overlay behind it (the black semi transparent layer) is not dismissing with the VC. When I try to dismiss, by clicking outside the VC the behaviour is correct.
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
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
When I have a textfield in the Pop, the keyboard will block my MJPop, how can i make it move up automatically ?
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
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,
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.
Could we add a button on popUpView add link to an action.
I tried to do so, but bad access show
Hi,
Could anyone plz tell me, how should i use MJPopupViewController with storyboard application.
Thanks in advance.
viewWillAppear:
viewDidAppear:
viewWillDisappear:
viewDidDisappear:
not called for popupViewController
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.
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?
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
if we present UINavigationController, when pushing or popping UIViewController, title in UINavigationBar beyonds the controller bounds.
Hello, i want know if i can insert a UIScrollView in the PopupViewController, and detect the scroll in the popup to scroll for example between image...
-(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 ?
Never mind I forgot add self delegate
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
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?
I'm encountering this error messages:
Automatic Reference Counting Issue
Automatic Reference Counting Issue
Automatic Reference Counting Issue
Automatic Reference Counting Issue
Automatic Reference Counting Issue
and a warning message:
Semantic issue
Any idea on how to fix this issues on the demo project included in the zip file? Thanks!
Hello, i notice that the viewwillappear method of the UIViewController i pass here:
presentPopupViewController
for the display in the pop up is called twice, why?
CGRect popupEndRect = CGRectMake((sourceSize.width - popupSize.width) / 2,
170,
popupSize.width,
popupSize.height);
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.
This control is super simple and easy to use. Im preparing in my fork a couple of updates:
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
I would like to take an action, when ever the popup is closed by tapping the bgView.
Is there a method to do so? If not please advice a solution.
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)
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.
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?
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?
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,
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.
In my test, once you try to scroll the table view inside, BAD_ACCESS happens without any error log.
how do I set popover position?
thx
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?
If you call presentViewController in a displayed popoupViewController, the new VC will be shown but after it is dismissed the positioning of the displayed popupviewcontroller is buggy.
Need urgent help. Any suggestions?
You have to tap on the view you present the modal on to get rid of the overlay view...
fix:
popupView.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:popupView.bounds cornerRadius:popupView.layer.cornerRadius].CGPath;
- (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 :(
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
It is impossible to make rounded popup view with background image, as maskToBounds = NO here: https://github.com/martinjuhasz/MJPopupViewController/blob/master/Source/UIViewController%2BMJPopupViewController.m#L112
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.
If we presented a viewcontroller using MJPopupViewController, then we can't perform push viewcontroller operation from that presented viewcontroller.
useful thing https://github.com/neror/ftutils
Under ARC, the popup view controller might be released before user dismiss it. And its view is still showing on the screen. At this time, if user click any button on the view, a EXC_BAD_ACCESS error will occur.
More info:
http://stackoverflow.com/questions/2070204/exc-bad-access-with-ibaction
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.
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;
@martinjuhasz, thanks for the work & releasing this. I'd like to setup a podspec for this (http://github.com/CocoaPods), but it would help if you could tag a release for this. Not sure if you want to declare this a 1.0, but even an intermediate version would be nice.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.