Objective c 弹出窗口可以';t关闭(iAction不工作)
我使用我在这里找到的弹出式系统: 按照指南一步一步地操作之后,除了关闭按钮外,其他一切都正常工作。我试着用各种方式把它联系起来,但都没用 有人知道我做错了什么吗 这是我的密码: PopUpController.h:Objective c 弹出窗口可以';t关闭(iAction不工作),objective-c,xcode,popup,xib,Objective C,Xcode,Popup,Xib,我使用我在这里找到的弹出式系统: 按照指南一步一步地操作之后,除了关闭按钮外,其他一切都正常工作。我试着用各种方式把它联系起来,但都没用 有人知道我做错了什么吗 这是我的密码: PopUpController.h: #import <UIKit/UIKit.h> //#import <QuartzCore/QuartzCore.h> #import "AppDelegate.h" @interface PopUpViewController : UIViewContr
#import <UIKit/UIKit.h>
//#import <QuartzCore/QuartzCore.h>
#import "AppDelegate.h"
@interface PopUpViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIView *popUpView;
- (void)showInView:(UIView *)aView animated:(BOOL)animated;
- (IBAction)closePopup:(id)sender;
@end
注意:我甚至没有关闭NSLog。。。在我的控制台上单击关闭按钮时
以下是我的.xib文件的屏幕截图:
感谢您的回复。您是否正确连接(现在将popUpView插座连接到.xib文件中的视图)。从您的引用中,我只是尝试重新链接视图并链接到主视图,但没有任何更改。。(只有按钮不起作用。弹出提示很好)使子视图操作正常。。。您必须添加为子视图控制器。所以要使关闭弹出功能。。。您需要将PopViewController作为子视图控制器添加到要显示弹出窗口的viewController。谢谢@NisarAhmad!就是这样,我添加了这一行:[self-addChildViewController:subV];它起作用了。我很乐意帮助你
#import "PopUpViewController.h"
@interface PopUpViewController ()
@end
@implementation PopUpViewController
- (void)viewDidLoad {
self.view.backgroundColor=[[UIColor blackColor] colorWithAlphaComponent:.6];
self.popUpView.layer.cornerRadius = 5;
self.popUpView.layer.shadowOpacity = 0.8;
self.popUpView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
self.popUpView.clipsToBounds = YES;
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma animation
- (void)showAnimate
{
self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
self.view.alpha = 0;
[UIView animateWithDuration:.25 animations:^{
self.view.alpha = 1;
self.view.transform = CGAffineTransformMakeScale(1, 1);
}];
}
- (void)removeAnimate
{
[UIView animateWithDuration:.25 animations:^{
self.view.transform = CGAffineTransformMakeScale(1.3, 1.3);
self.view.alpha = 0.0;
} completion:^(BOOL finished) {
if (finished) {
[self.view removeFromSuperview];
}
}];
}
- (void)showInView:(UIView *)aView animated:(BOOL)animated
{
[aView addSubview:self.view];
if (animated) {
[self showAnimate];
}
}
- (IBAction)closePopup:(id)sender {
NSLog(@"closing...");
[self removeAnimate];
}
@end