[英]i changed my first screen of my iphone app, but uibutton click event doesnt work
我更改了iPhone应用程序的第一个屏幕,因为我想进入一个屏幕,在进入主要工作和屏幕之前,我将单击一个按钮。 我为此更改了我的appdelegate代码;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
LoadingViewController *m_view = [[[LoadingViewController alloc]initWithNibName:@"LoadingViewController" bundle:nil] autorelease];
m_view.window = window;
[self.window addSubview:m_view.view];
[self.window makeKeyAndVisible];
// Override point for customization after app launch
//[window addSubview:viewController.view];
//[window makeKeyAndVisible];
}
我创建一个viewcontroller类;
h文件;
#import <UIKit/UIKit.h>
@interface LoadingViewController : UIViewController {
UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;
- (IBAction)startButtonClick:(id)sender;
- (IBAction)favoriButtonClick:(id)sender;
@end
和.m文件;
- (IBAction)startButtonClick:(id)sender {
ScrollViewWithPagingViewController *yellowController = [[ScrollViewWithPagingViewController alloc]initWithNibName:@"ScrollViewWithPagingViewController" bundle:nil];
[self presentModalViewController:yellowController animated:YES];
[yellowController release];
}
但是当我单击按钮时,没有执行此单击操作。 我以前这样会出错
请帮助我,我不明白怎么了?
----- ************************************************* * ----我解决了!
更改此代码;
LoadingViewController *m_view = [[[LoadingViewController alloc]initWithNibName:@"LoadingViewController" bundle:nil] autorelease];
我删除自动发布;
LoadingViewController *m_view = [[LoadingViewController alloc]initWithNibName:@"LoadingViewController" bundle:nil];
看来您的问题可能与您管理窗口的方式有关。 您只需要使一个键可见即可,并且不必在视图控制器中包括该窗口(除非您在控制器中执行其他特殊操作)。 我将保留默认的窗口行为,仅将控制器的视图添加为子视图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.