splashscreen.h
@interface SplashScreen : UIViewController {
HomePage *newEnterNameController;
}
@property(nonatomic,retain)HomePage *newEnterNameController;
@end
splashscreen.m
@implementation SplashScreen
@synthesize newEnterNameController;
-(void)homepage
{
self.newEnterNameController = [[HomePage new] initWithNibName:@"HomePage"bundle:
[NSBundle mainBundle]];
[newEnterNameController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:self.newEnterNameController animated:YES];
}
- (void)dealloc {
[self.newEnterNameController release];
[super dealloc];
}
@end
答案 0 :(得分:0)
用 - (IBAction)主页替换 - (void)主页:( id)sender,并从界面构建器重新链接按钮,或者以编程方式重新链接,具体取决于您的UIButton创建代码
答案 1 :(得分:0)
self.newEnterNameController = [[HomePage new] initWithNibName:@"HomePage"bundle: [NSBundle mainBundle]];
[Class new]
等于[[Class alloc] init]
,因此您要初始化对象两次。这一行应该如下所示:
self.newEnterNameController = [[HomePage alloc] initWithNibName:@"HomePage"bundle: [NSBundle mainBundle]];
答案 2 :(得分:0)
而不是:
-(void)homepage
{
self.newEnterNameController = [[HomePage new] initWithNibName:@"HomePage"bundle:
[NSBundle mainBundle]];
[newEnterNameController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:self.snewEnterNameController animated:YES];
}
尝试:
-(IBAction)homepage
{
self.newEnterNameController = [[[HomePage alloc] initWithNibName:@"HomePage"bundle:
[NSBundle mainBundle]]autorelease];
[newEnterNameController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:self.snewEnterNameController animated:YES];
}
并将其连接到界面构建器中的按钮。现在看到结果。