My object is staying alive and I’m not sure why. I’m sure the reason(s) are obvious, but I’m too green to see them. I’m watching the allocations in instruments and the memory is never released..
My header file is attached. How SHOULD I be taking care of business here? Thanks for advice/suggestions.
FYI – This is for ios5 developed with xcode 4.3. ARC is enabled.
** EDITS / ADDITIONS **
-
This UIView is what is staying alive even after I switch to a completely different View Controller (via storyboard segue). I suspect it’s a strong reference or a reference that can’t be let go of?
-
As far as I can tell, this view is never released.
-
I’m tracking allocations with intruments new->allocations => choose target->ios 5.1 device => record. And just watching the graph as I touch around.
#import <UIKit/UIKit.h>
#import "ValidatedTextField.h"
@interface LoginView : UIView {
NSString *loginEmail;
NSString *loginPassword;
}
@property (nonatomic, weak) IBOutlet UIView *loginView1;
@property (nonatomic, weak) IBOutlet UIView *loginView2;
@property (nonatomic, weak) IBOutlet UIView *loginView3;
@property (nonatomic, weak) IBOutlet UIView *loginView4;
@property (nonatomic, weak) IBOutlet UIView *recoverView1;
@property (nonatomic, weak) IBOutlet UIView *recoverView2;
@property (nonatomic, weak) IBOutlet UIScrollView *loginSV;
@property (nonatomic, weak) IBOutlet UIScrollView *recoverSV;
@property (nonatomic, weak) IBOutlet ValidatedTextField *signInEmailInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *signInPassInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *createEmailInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *createFirstNameInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *createLastNameInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *passInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *rePassInput;
@property (nonatomic, weak) IBOutlet ValidatedTextField *recoverIDInput;
@property (nonatomic, weak) IBOutlet UIButton *signInBtn;
@property (nonatomic, weak) IBOutlet UIButton *forgotPassBtn;
@property (nonatomic, weak) IBOutlet UIButton *createAccountBtn;
@property (nonatomic, weak) IBOutlet UIButton *createBackBtn;
@property (nonatomic, weak) IBOutlet UIButton *createContinueBtn;
@property (nonatomic, weak) IBOutlet UIButton *passBackBtn;
@property (nonatomic, weak) IBOutlet UIButton *passContinueBtn;
@property (nonatomic, weak) IBOutlet UIButton *sumBackBtn;
@property (nonatomic, weak) IBOutlet UIButton *sumSubmitBtn;
@property (nonatomic, weak) IBOutlet UIButton *recoverBackBtn;
@property (nonatomic, weak) IBOutlet UIButton *recoverPassBtn;
@property (nonatomic, weak) IBOutlet UIButton *returnToSignInBtn;
@property (nonatomic, weak) IBOutlet UILabel *signInEmailError;
@property (nonatomic, weak) IBOutlet UILabel *createEmailError;
@property (nonatomic, weak) IBOutlet UILabel *passwordError;
@property (nonatomic, weak) IBOutlet UILabel *sumEmail;
@property (nonatomic, weak) IBOutlet UILabel *sumFirstName;
@property (nonatomic, weak) IBOutlet UILabel *sumLastName;
@property (nonatomic, weak) IBOutlet UILabel *sumPassword;
@property (nonatomic, weak) IBOutlet UILabel *emailedToTxt;
-(IBAction)signInTUI:(id)sender;
-(IBAction)forgotPassTUI:(id)sender;
-(IBAction)createAccountTUI:(id)sender;
-(IBAction)createBackTUI:(id)sender;
-(IBAction)createContinueTUI:(id)sender;
-(IBAction)passBackTUI:(id)sender;
-(IBAction)passContinueTUI:(id)sender;
-(IBAction)sumBackTUI:(id)sender;
-(IBAction)sumSubmitTUI:(id)sender;
-(IBAction)recoverBackTUI:(id)sender;
-(IBAction)recoverPassTUI:(id)sender;
-(IBAction)returnToSignInTUI:(id)sender;
@end
I’m assuming here you mean that you’re segue-ing it as a push onto a navigation controller stack or you’re presenting modally or something:
It shouldn’t necessarily be deallocated when you go to a new view controller. The original view controller, hence its view and hence your custom view will still stay alive until UIKit decides to kill it because memory is getting low. At that point your view controller object would still stay alive, but its view would be unloaded and you’d get the
viewDidUnload. Only when you remove that view controller completely from any navigation controller / tab controller / dismiss it if it modal, will it be completely destroyed.