所以我在我的第一個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