所以我在我的第一个iPhone应用程序。我其实很深入。我已经从许多错误中学到了东西,但我觉得我犯了一个最终的错误。我使用segues导航到不同的视图。我深入了解了大约5个segue视图,我意识到这导致了很多分配的内存。换句话说,View A调用View B,B调入C,C调入D等。从我所了解的情况来看,当我到达D时,我现在有了A B C和D open的实例,这听起来不太好。我使用的代表,例如象下面这样:使用分段感觉糟糕的设计版式
的只是一个例子我在做什么在我的应用程序:
首先查看:
@interface FirstViewController : UIViewController<SecondViewControllerDelegate>
@end
第二个视图:
@class SecondViewController;
@protocol SecondReviewOrderViewControllerDelegate <NSObject>
- (void)secondViewControllerDidCancel:(SecondViewController *)controller;
@end
@interface SecondViewController : UIViewController<ThirdViewControllerDelegate>
@property (strong, nonatomic) id <SecondViewControllerDelegate> delegate;
@end
第三个视图:
@class ThirdViewController;
@protocol ThirdReviewOrderViewControllerDelegate <NSObject>
- (void)thirdViewControllerDidCancel:(ThirdViewController *)controller;
@end
@interface ThirdViewController : UIViewController<>
@property (strong, nonatomic) id <ThirdViewControllerDelegate> delegate;
@end
等等和到视图4和5
我的问题是,如果这是错误的,它似乎是,什么是关于导航的观点和传递数据的正确方法一个viewcontroller到另一个?感谢您的任何提示。
通常一些viewcontroller实例不会是一个内存问题,但这是非常依赖于应用程序。你实际上对视图控制器实例的内存有问题吗?你有没有在Allocations中运行你的应用程序,并看到内存压力问题?或者这只是过早的优化? – 2013-05-07 02:01:20
我已经运行xcode工具,并且看到进入深度赛段的分配很高。另外我不使用NavigationControllers,我只是使用ViewControllers – TMan 2013-05-07 02:02:50
基本上,我将视频上载到View D中的服务器,而且我有一些随机上传问题,上传只是暂停和挂起,并且没有报告错误或超时。我想知道是否所有这些分配的内存都与它有关。 – TMan 2013-05-07 02:05:03