我正在打开一个视图控制器(带有一个导航栏和一个用于关闭视图控制器的栏按钮项)。这是一个视图控制器,用于在用户单击“帮助”按钮时向用户显示信息。导航是这样的:ViewController1 -> “帮助”按钮 -> Viewcontroller2. Viewcontroller2 有一个“关闭”按钮,可以关闭这个 ViewController。我有一个带有 IBAction 的关闭按钮连接到文件的所有者。但是当我单击“关闭”按钮时没有命中断点。代码是:
DetailViewController.m(viewcontroller1):
-(void) showHelp:(id)sender
{
HelpViewController *helpWindow = [[HelpViewController alloc]initWithNibName:@"HelpViewController" bundle:[NSBundle mainBundle]];
helpWindow.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:helpWindow animated:YES];
}
HelpViewController.m(viewcontroller2):
#import "HelpViewController.h"
@interface HelpViewController ()
@end
@implementation HelpViewController
@synthesize scrollView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)closeAction:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}
@end
我尝试在“closeAction”处设置断点,但没有命中。我是 iOS 开发的新手。我在这里遗漏了一些非常明显的东西。感谢任何帮助!