我创建了一个新的应用程序视图。这里有一些主要代码:
// 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 (code=2, address=....)
你能帮我理解如何解决这个问题吗?
更新
问题是由于在 AddDelegate 加载期间设置了 UIButton 外观……但第一个按钮在我要加载的 UIView 中……这就是它崩溃的原因-.-”