试图让我的iphone应用程序通用.导航控制器一直在说不平衡呼叫



已经尝试了几个小时来实现我的iphone应用程序的通用性。这次任务很成功,但有一个奇怪的问题。导航控制器一直在推东西,甚至什么都没推。该应用程序没有崩溃,但它在控制台中给了我一条消息

nested push animation can result in corrupted navigation bar 2012-02-06 10:52:07.701 @#$%^^$[54755:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted. 2012-02-06 10:52:07.704 !@#$%^$%#[54755:207] Unbalanced calls to begin/end appearance transitions for <searchEditViewController: 0xc652150>.

以下是我如何设置应用程序的全部内容:

[导航屏幕截图][1]

这是我在AppDelegate_iphone.h 中的代码

#import <UIKit/UIKit.h>
#import "iPhoneView.h"
#import "AboutUsViewController.h"
#import "FavoritesViewController.h"
@class iPhoneView;
@interface AppDelegate_iPhone : NSObject <UIApplicationDelegate> {
    UITabBarController *tabBarController;
    UINavigationController *homeNavigationController;
    UINavigationController *favouritesNavigationController;
    AboutUsViewController *aboutUsViewController;
    iPhoneView * search;
    FavoritesViewController *favoritesViewController;
    UIWindow *window;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet iPhoneView *search;
@property (nonatomic, retain) FavoritesViewController *favoritesViewController;
@end

这是我的AppDelegate.m文件

#import "AppDelegate_iPhone.h"
#import "iPhoneView.h"
@implementation AppDelegate_iPhone
@synthesize window,search,favoritesViewController;

#pragma mark -
#pragma mark Application lifecycle
- (void)applicationDidFinishLaunching:(UIApplication *)application 
{   tabBarController = [[UITabBarController alloc] init];
    homeNavigationController = [[UINavigationController alloc] init];
    search = [[iPhoneView alloc] init];
    [homeNavigationController pushViewController:search animated:NO];
    favouritesNavigationController = [[UINavigationController alloc] init];
    favoritesViewController = [[FavoritesViewController alloc]init];
    [favouritesNavigationController pushViewController:favoritesViewController animated:NO];
    aboutUsViewController =[[AboutUsViewController alloc] init];
    UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"επικοινωνία" image:[UIImage imageNamed:@"aboutus"] tag:0];
    aboutUsViewController.tabBarItem = item;
    [item release];
    UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:@"αγαπημένα" image:[UIImage imageNamed:@"favorites"] tag:0];
    favouritesNavigationController.tabBarItem = item2;
    [item2 release];
    NSArray *tabBarControllerCollection = [NSArray arrayWithObjects:homeNavigationController,favouritesNavigationController,aboutUsViewController,nil];
    [tabBarController setViewControllers:tabBarControllerCollection animated:NO];
    [window addSubview:tabBarController.view];
    [window makeKeyAndVisible];
}

- (void)applicationWillResignActive:(UIApplication *)application {
    /*
     Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     */
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
     */
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    /*
     Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
     */
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
     Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     */
}

- (void)applicationWillTerminate:(UIApplication *)application {
    /*
     Called when the application is about to terminate.
     See also applicationDidEnterBackground:.
     */
}

#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    /*
     Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
     */
}

- (void)dealloc {
    [tabBarController release];
    [search release];
    [favoritesViewController release];
    [favouritesNavigationController release];
    [aboutUsViewController release];
    [window release];
    [super dealloc];
}

@end

OK solve在IB中用相同的操作连接了按钮2次。我花了48小时才弄清楚!

最新更新