ios为什么我的物品还活着?

时间:2012-03-28 21:27:12

标签: ios cocoa

我的目标是活着,我不确定为什么。我确定原因是显而易见的,但我也是绿色看到它们。我正在观看乐器中的分配,内存永远不会被释放..

我的头文件已附加。我应该如何在这里照顾生意?感谢您的建议/意见。

仅供参考 - 这是使用xcode 4.3开发的ios5。 ARC已启用。

**编辑/补充**

  • 即使我切换到一个完全不同的View Controller(通过storyboard segue),这个UIView仍然存活。我怀疑它是一个强大的参考或参考不能放弃?

  • 据我所知,这种观点从未发布过。

  • 我正在使用intruments new跟踪分配 - > allocations =>选择target-> ios 5.1 device =>记录。只是在我触摸时观看图表。


#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

1 个答案:

答案 0 :(得分:3)

  

即使在切换到完全不同的View Controller(通过故事板segue)之后,这个UIView仍然存活。我怀疑它是一个强大的参考或参考不能放弃?

我在这里假设你的意思是你将它作为推送到导航控制器堆栈上,或者你是以模态或其他方式呈现:

当您转到新的视图控制器时,不一定要取消分配。原始视图控制器,因此它的视图,因此你的自定义视图仍将保持活着,直到UIKit决定杀死它,因为内存越来越低。此时,您的视图控制器对象仍将保持活动状态,但其视图将被卸载,您将获得viewDidUnload。只有当您从任何导航控制器/选项卡控制器中完全删除该视图控制器时,如果它是模态的,则将其解除,它是否会被完全销毁。