【发布时间】:2011-08-21 21:53:15
【问题描述】:
大家好,我是 cocoa 的新手开发人员,我正在尝试创建一个简单的应用程序。它显示了 4 个不同的页面,您可以通过标签栏选择它们。
我的问题:我使用 IB 在第一页/主页 (==>FirstView.xib) 上创建了一个 UIButton,并尝试使用在网。
问题是我可以构建我的代码,但是当我尝试点击我的按钮时没有任何反应,你能帮帮我吗?
FirstView.h 的代码:
#import <UIKit/UIKit.h>
@interface FirstViewController : UIViewController {
UIButton *button;}
@property (nonatomic, retain) IBOutlet UIButton *button;
- (IBAction)goToViewTwo;
@end
FirstView.m 的代码: @implementation FirstViewController @synthesize 按钮;
- (IBAction)goToViewTwo {
SecondViewController *SecondView= [[SecondViewController alloc] initWithNibName: @"SecondView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:SecondView animated:YES];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)dealloc {
[super dealloc];
[button release];
}
@end
关于 FIrstVIew.xib 中的 outlets:
我将“Touch Up Inside”链接到“goToViewTwo”,将“b^utton”链接到“File's Owner”
【问题讨论】:
标签: cocoa-touch xcode ios uibutton