私は、アプリケーションデリゲートでタブバーコントローラを作成します。最初のビューは、最初のビューコントローラと呼ばれていないすなわち UITabBarControllerがEXC_BAD_ACCESSをスローする
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UINavigationController *localNav;
tabBar = [[UITabBarController alloc] init];
NSMutableArray *controllerArray = [[NSMutableArray alloc] initWithCapacity:2];
FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
localNav = [[UINavigationController alloc] initWithRootViewController:FirstViewController];
localNav.navigationBar.tintColor = [UIColor blackColor];
[controllerArray addObject:localNav];
[firstViewController release];
SecondViewController *secondViewController;
secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
localNav = [[UINavigationController alloc] initWithRootViewController:secondViewController];
[controllerArray addObject:localNav];
[localNav release];
[SecondViewController release];
tabBar.viewControllers = controllerArray;
[controllerArray release];
[localNav release];
[window addSubview:tabBar.view];
[self.window makeKeyAndVisible];
return YES;
}
私は変数名を変更(:ここ
#import <UIKit/UIKit.h>
@interface appAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
UITabBarController *tabBar;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UITabBarController *tabBar;
@end
メートルファイル内の関連する機能がされています。ここでの.hと.mファイルファイルがあります)。アプリはロードし、私が選択できる2つのタブを表示します。私がモーダルポップアップを表示しようとすると、問題が発生します。私はボタンを押すとモーダルを表示する必要があります。
ここに.hファイルがあります。カスタムボタンは、UIButtonをまっすぐに延長するだけで、ボタンのコーナーを丸くします。デリゲートは、ちょうど大丈夫ですかキャンセル2つのボタンの機能を持っている:私は、ボタンを押すのための機能を実行すると
#import <UIKit/UIKit.h>
#import "CustomButton.h"
#import "StartModal.h"
#import "CurrentEntry.h"
@interface FirstViewController : UIViewController <StartModalDelegate>{
CustomButton *startEntry;
}
@property (nonatomic, retain) IBOutlet CustomButton *startEntry;
- (IBAction) startLogEntry;
- (void) locationSelection;
- (void) dismissHandler;
- (void) saveHandler;
@end
EXC_BAD_ACCESSがでてきます。ここには.mファイルがあります:
- (IBAction) startLogEntry {
NSLog(@"start the entry here");
StartPoopModal *modal = [[StartModal alloc] initWithNibName:@"StartModal" bundle:nil];
[modal setDelegate:self];
UINavigationController *localNav;
localNav = [[UINavigationController alloc] initWithRootViewController:modal];
localNav.navigationBar.tintColor = [UIColor blackColor];
[self.tabBarController presentModalViewController:localNav animated:YES];
[modal release];
}
[self.tabBarController presentModalViewController ....]はエラーをスローします。これは過去に働いていて何らかの理由でエラーを投げています。私が知る限り、私はそれを変更していない。私はバージョン管理のどのような形でもこれを持っていないので、私はそれを二重チェックすることはできません。
クラッシュログはありますか? –
私はそれを理解しました。パトリックはリリースについて良い点を挙げている。私は1つのビューコントローラを作成し、それを間違った場所にコピー/貼り付け、完全には見ていませんでした。間違っているタイプに関するもう一つの点は、私が質問で正しく名前を更新しなかったので問題ではありませんでした。私は、ビュー(タブ、ナビゲーションバー、およびモーダル)を使用するためのさまざまな方法をすべて理解し、StartPoopModalという名前をつけたばかだと思っていましたが、その質問には使いたくありませんでした。とにかく問題が何だったのか、それはモーダルのサブビューでした(もう一度試してみると) – Joshua