我已經創建了一個新的應用程序視圖的基礎。 這裏是一些主要的代碼:不可能presentViewController
// AppDelegate.h
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
UINavigationController *navigationController;
MIAPreferences *preferences;
}
@property (strong, nonatomic) UINavigationController *navigationController;
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) MIAPreferences *preferences;
// AppDelegate.m
@implementation AppDelegate
@synthesize window = _window;
@synthesize navigationController;
@synthesize preferences;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
// Override point for customization after application launch.
UIViewController *rootController = [[HomeViewController alloc] initWithNibName:nil bundle:nil];
navigationController = [[UINavigationController alloc]
initWithRootViewController:rootController];
navigationController.navigationBar.hidden = YES;
self.window = [[UIWindow alloc]
initWithFrame:[[UIScreen mainScreen] bounds]];
_window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
return YES;
}
// HomeViewController.m
-(IBAction)openLogin
{
LoginViewController *view = [[LoginViewController alloc] initWithNibName:nil bundle:nil];
// 1
[self.navigationController presentViewController:view animated:YES completion:nil];
// 2
[self.navigationController pushViewController:view animated:YES];
// 3
[self presentViewController:view animated:YES completion:nil];
}
所有3個選項返回EXC_BAD_ACCESS(代碼= 2,地址= ....)
能否請你幫我瞭解如何解決這個問題?
UPDATE
的問題是由於一個UIButton AddDelegate加載期間apparence設立....但第一個按鈕是UIView的,我要加載......這就是爲什麼它墜毀 - 。 - 「
堆棧跟蹤? – CodaFi