试图让我的 iPhone 应用程序变得通用。导航控制器一直显示呼叫不平衡

发布于 2025-01-02 10:47:47 字数 4909 浏览 1 评论 0原文

我已经尝试了几个小时来让我的 iPhone 应用程序变得通用。任务很成功,但遇到了一个奇怪的问题。导航控制器不断推动东西,甚至不推动任何东西。该应用程序不会崩溃,但它在控制台中给我一条消息

嵌套推送动画可能会导致导航栏损坏 2012-02-06 10:52:07.701 @#$%^^$[54755:207] 在意外状态下完成导航转换。导航栏子视图树可能会损坏。 2012-02-06 10:52:07.704 !@#$%^$%#[54755:207] 对的开始/结束外观转换的调用不平衡。

这是我如何设置应用程序的整个过程:

![导航屏幕截图][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

have been trying couple of hours now to make my iphone app universal. The mission was successful but have a strange problem. The navigation controller keeps pushing things without even pushing anything. The app doesn't crash but it gives me a message in the console

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>.

and here is how i've set app the whole thing :

![navigation screen shot][1]

here is my code in the 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

and here is on my AppDelegate.m file

#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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

御弟哥哥 2025-01-09 10:47:47

OK,解决了在 IB 中使用相同操作连接按钮 2 次的问题。我花了48个小时才弄清楚!

OK solved had connected the button 2 times with the same action in IB. Took me 48hours to figure it out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文