jmascia / klcpopup Goto Github PK
View Code? Open in Web Editor NEWA simple and flexible class for presenting custom views as a popup in iOS.
License: MIT License
A simple and flexible class for presenting custom views as a popup in iOS.
License: MIT License
I don't know why, but it's not working together in iOS8 ;(
popup just not showing up, without any error
What do u mean by keyboard show/hide in the TODO list ?
Suppose, I'm showing a (programmatically created) table view with KLCPopup, now I want to reload that table. Is there a way that I can have access to that table view?
For a note, I am not keep a copy (or reference) of that table view? simply, I don't like to take a ivar for this stuff.
Thanks in advance!
I declare a global variable(KLCPopup), and find contentView is not remove from popup after dismiss the popup. And show a new contentView by the popup, there are actually two contentViews in the popup.
I know there is a callback(didFinishDismissingCompletion), user can add
contentView.removeFromSuperView()
into the callback.
But I do not think everyone want to add the extra code.
Is my thought wrong?
`- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView* hitView = [super hitTest:point withEvent:event];
if (hitView == self) {
// Try to dismiss if backgroundTouch flag set.
if (_shouldDismissOnBackgroundTouch) {
[self dismiss:YES];
}
// If no mask, then return nil so touch passes through to underlying views.
if (_maskType == KLCPopupMaskTypeNone) {
return nil;
} else {
return hitView;
}
} else {
// If view is within containerView and contentTouch flag set, then try to hide.
if ([hitView isDescendantOfView:_containerView]) {
if (_shouldDismissOnContentTouch) {
[self dismiss:YES];
}
//Shouldn't this code exist here
if (_maskType == KLCPopupMaskTypeNone) {
return nil;
}
return hitView;
}
}
`
Currently, CocoaPods is reporting 1.0 as the current version of KLCPopup. Could you guys push out 1.1 to CocoaPods?
The description fails to mention that this is a cocoapod.
First of all, your popup works great! But when it dismissed it also removes view from its superview and I'll need to recreate it at the time of re popup it. Any way to change this behaviour?
I will try to fork it and submit a pull request, but I really want to have a call back so I know when it was dismissed.
Even the basic example doesn't work. No error. No popup. Just nothing.
In iOS 8, displaying a UIPopover control from a button tap on the modal itself fails. Popover does not display. It works fine in IOS 7.
I am trying to use this popup on iPad but it doesn't rotate to support landscape mode.
Is there any workaround?
Hello;
I want to avoid scrolling if the view is large. How can I do that?
Hi
I have a xib file that use KLCPopup for show popup view.
when use view whitout KLCPopup, boutton IBAction fire; but when use KLCPopup boutton IBAction don't fire!
Please Help, Thanks
I ran into an issue where I had a textfield inside a view that was used for the popup. Normally, tapping on text field brings up a keyboard, and if i tap anywhere in the background area (i.e. not on the keyboard, not on the popup view), then the popup is dismissed.
However, if you hit the Home button and send app to the background, then bring it back, and open up a popup again... the second you type your first key on the keyboard, the popup dismisses. It seems this is because it is interpreting tapping on the keyboard as a background tap. I tried looking into it but it seem it's using the core UIView hitTest method, which I guess doesn't account for keyboard taps (but only in the case when app is being revived from background).
I ended up just disabling background touch dismiss as a workaround, but thought I should bring this issue to your attention.
Calling dismiss immediately after calling show shows the popup and never dismisses it.
When the popview is at bottom, and has a textfield. how can i to avoid the cover over the textfield when begin input?
How to use
@property (nonatomic, copy) void (^didFinishDismissingCompletion)();
block to notify when popup get dismissed?
Any example would be appreciated.
How to get blurred background view with KLCPopup?
Love the pod, but I'm having one issue - the first time my popup appears (either when I set .GrowIn
explicitly or just don't set it at all) it scales up, correctly, from the center of the screen. Every subsequent time it appears, it scales up from what seems to be the upper left side of the screen. See below:
I see lot of compilation errors in .h and .m files after adding them to my swift 3 project. How should i resolve compilation issue?
After I created a new project in XCode 6 and import KLCPopup.h, I got the following error:
This issue is caused by ProjectName-Prefix.pch is not created automatically in Xcode 6, thus the following import is missing:
UIKit/UIKit.h
Foundation/Foundation.h
You can follow the following discussion to add .pch back manually:
http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6
I love KLCPopup! Hope it support keyboard. Thanks!
I find the following code in the lib:
[_containerView removeConstraints:_containerView.constraints];
[_containerView addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[contentView]|"
options:0
metrics:nil
views:views]];
[_containerView addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[contentView]|"
options:0
metrics:nil
views:views]];
It means constraints are used for contentview,but do not set translatesAutoresizingMaskIntoConstraints to false, I think the constraints do not works. translatesAutoresizingMaskIntoConstraints
I think should add the following code:
[contentView setTranslatesAutoresizingMaskIntoConstraints:NO];
Hello guys,
i have always one of these errors (randomly) when i press the button in my view :
With KLCPopup I have always one of these errors (randomly) when i press the button of my view contained in the KLCPopup:
NSInvalidArgumentException', reason: '-[NSISLinearExpression sendPlus:](most of times) bad_access_exc code=1
Here's my code to call the KLCPopup in « FindViewController »
AddFeelingViewController *adf = [self.storyboard instantiateViewControllerWithIdentifier:@"AddFeelingView"];
adf.userTo = [_userFetch objectAtIndex:indexPath.row];
adf.controller = self;
adf.view.frame = CGRectMake(0.0, 0.0, 300.0, 250.0);
KLCPopup *popup = [KLCPopup popupWithContentView:[adf view] showType:KLCPopupShowTypeBounceIn dismissType:KLCPopupDismissTypeBounceOut maskType:KLCPopupMaskTypeDimmed dismissOnBackgroundTouch:YES dismissOnContentTouch:NO];
[popup show];
And here the code called in my « AddFeelingViewController » when i press the button :
(void)viewDidLoad {
[super viewDidLoad];
score = 0;
if([_controller isKindOfClass:[FindViewController class]]){
_controller = (FindViewController*)_controller;
}else{
_controller = (HomeViewController*)_controller;
}
(IBAction)sendPlus:(id)sender {
score = 1;
}
Everything is well linked in the storyboard and it only crashes if the buttons are linked.
Have you an idea ?
Hello,
I've been using KLCPopup in my project, and I've been trying to dismiss a popup on button click.
Context :
I have a nib with my popup , inside there are 2 buttons (yes, no).
I load my nib into my klcpopup and instantiate it to show on screen
Problem :
When I click on one of the buttons, If I put anything in the IBAction connected to the button in nib, it will crash without telling me one thing in debugger, just gives me a EXC_BAD_ACCESS on AppDelegate class.
code snippets :
my func to show the alert
func showAlertWithButtons(message: String?, title: String?) {
var nibView = NSBundle.mainBundle().loadNibNamed("buttonAlertView", owner: self, options: nil)[0] as? UIView
alertTitle.text = title!
alertMessage.text = message!
var mainWindow = UIApplication.sharedApplication().keyWindow
nibView?.frame = CGRectMake(nibView!.frame.origin.x, nibView!.frame.origin.y, mainWindow!.frame.size.width, nibView!.frame.size.height)
alertPopup = KLCPopup(contentView: nibView, showType: KLCPopupShowType.SlideInFromRight, dismissType: KLCPopupDismissType.GrowOut,
maskType: KLCPopupMaskType.Dimmed, dismissOnBackgroundTouch: true, dismissOnContentTouch: false)
alertPopup!.show()
}
my IBAction
@IBAction func didClickOnYes(sender : AnyObject)
{}
I tried setuping a nsnotification in my IBAction but it crashes.
Is there a way to dismiss my popup from an IBAction, if so what am I doing wrong ?
Hey, many thanks for an awesome popup!
I am a fan of designing in the storyboard, and right now I have my content view connected as a Container View on the root view controller. I also have a controller called PopupViewController assigned to the content view. This works fine until I call showWithLayout after dismissing it once. I get an error in KLCPopup.m, line 539, saying that
UIViewControllerHierarchyInconsistency, reason: child view controller:PopupViewController: 0x1104987d0 should have parent view controller:(null) but actual parent is:MainViewController: 0x10a920680
Do you know why this happens?
I'm fairly certain this is KLCPopup.
When I use UIImageView as the contentView, I can successfully disable the touch to dismiss. I attach a UITapGestureRecognizer to KLC to dismiss on touch.
When I use a UIView as the contentView, touch to dismiss is always enabled, and my UITapGestureRecognizer never gets called.
Switching to UIImageView solves the problem.
I first had KLCPopup
manually imported into my project and everything worked as desired. Then I decided to switch over and use it through cocoapods and this issue happened.
The popup is allocated from the viewWillAppear
it works fine when the viewcontroller is accessed for the first time, but going back on the navigation controller, and accessing the view controller again, the popup is located at (0,0).
Tried this with no luck:
KLCPopupLayout layout = KLCPopupLayoutMake(KLCPopupHorizontalLayoutCenter,KLCPopupVerticalLayoutCenter);
At first I use Cocoapods to install the KLCPopup in my project, and the version is 1.0...
And then I found that when in iOS8, I rotatie the device from portrait to landscape left, the popupView rotated 180 degrees...
At last, I check the source code and compare with the code in git, IT WAS DIFFERENT!!!!!
And the code in github is working perfect
SO CHEAT YOU PAPA...(坑爹) -,-
By the way, This popup is great, I love it so much! Thank u.
Hey,
Not sure if it is a bug or I am doing something wrong.
I got this code:
var loadingPopupView = KLCPopup(contentView: LoadingIndicatorPopupView(), showType: KLCPopupShowType.BounceIn, dismissType: KLCPopupDismissType.BounceOut, maskType: KLCPopupMaskType.Dimmed, dismissOnBackgroundTouch: false, dismissOnContentTouch: true)
loadingPopupView.show()
loadingPopupView.dismiss(true)
loadingPopupView.dismiss(false)
KLCPopup.dismissAllPopups()
popup shows but is never hidden. I got another popup which is dismissed via self.dismissPresentingPopup()
from inside the view and that seem to work. But when I am trying to dismiss it from outside - it never gets dismissed.
because of dismissOnContentTouch: true
it is dismissed by touching on content.
Any ideas ?
How to get instance of currently visible KLCPopup ?
First time default configured popup showing normal, but second and others time it's starting from x-something and y-something coords. I think you'll get this bug with no problem.
iPhone and iPad, iOS8
Hello.
I have popup with X button on top (to dismiss). I also have two text fields in my popup. Whole popup is connected to XIB, and I normally present it. But when I start typing something inside text field, keyboard hides the popup, so I created method :
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
[UIView animateWithDuration:0.6 animations:^{
[self setCenter:CGPointMake(self.superview.frame.size.width/2, 85)];
}];
}
I change center of the popup so it is not hidden under keyboard, but then the X button is not clickable. It looks like the visible popup moved up, and the "clickable area" remains where it was. The X is outside the "clickable area", so I can't interact with it. How to solve it?
Is there a way to show several popups, for example, 4, one after the other, and making the background be dimmed until all popups are finished? Currently, I am using an NSTimer and it dims in and dims out for each popup. Thanks in advance
Hey guys, how can I use this library with UIView in storyboard?
hi ,
I think KLCPopUP instance can not load view from .xib file or storyboard that view contains UICollectionView object !
I first showing KLCPopup with KLCPopupVerticalLayoutCenter,and when it is showing,I want to change its layout to KLCPopupVerticalLayoutAboveCenter,how to do that?
I have open view controller by using KLCPopup.In this view controller contain one button.On click those button i have presently open image picker.Then when dismiss image picker view at that time KLCPopup view display in full screen.
if i set translatesAutoresizingMaskIntoConstraints property to false ,Then when dismiss image picker view at that time KLCPopup view not display.
Hi;
I was using KGModal before. I was showing popup with the view controller, so buttons inside the popup view was working.
But with KLCPopup, I couldn't succeed. What is the best way to do this?
You should add this to Cocoapods so developers can easily add this library to their projects without having to pull down this repo and drag files over. This is a really cool library, and it'd be awesome to have a pod for it.
i am tried to open in klcpopup when tap the tableviewcell object, its opening well but what happening was its open how many times i click on that object that much times the popup was opened, I am using tap gesture for that to open. Below are my codes,
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; singleTap.numberOfTapsRequired = 1; [dot setUserInteractionEnabled:YES]; dot.tag=i; [dot addGestureRecognizer:singleTap];
and in selector:
`
- (void)tapDetected:(UITapGestureRecognizer *)recognizer {
NSLog(@"single Tap on imageview: %ld",recognizer.view.tag);
Buypopklc* myViewObject = [[[NSBundle mainBundle] loadNibNamed:@"Buypopklc" owner:self options:nil] objectAtIndex:0];
myViewObject.delegate=self;
[myViewObject updatecontrols:selectedlead];
KLCPopupLayout layout = KLCPopupLayoutMake((KLCPopupHorizontalLayout)KLCPopupHorizontalLayoutCenter,
(KLCPopupVerticalLayout)KLCPopupVerticalLayoutCenter);
popuptype = [KLCPopup popupWithContentView:myViewObject
showType: (KLCPopupShowType)KLCPopupShowTypeBounceInFromBottom
dismissType:(KLCPopupDismissType)KLCPopupDismissTypeBounceOutToBottom
maskType:(KLCPopupMaskType)KLCPopupMaskTypeDimmed
dismissOnBackgroundTouch:YES
dismissOnContentTouch:NO];
[popuptype showWithLayout:layout];
}`
here buypopklc was my xib file, hope you will understand please help me to solve this issue.
this lib will add support for ios6?
I would expect this method name to show the popup in the view, but it just adds the popup to the window unless the popup already has a superview.
Probably just needs clearer documentation.
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.