我目前有一个标题,显示名称,时间和几个按钮。只有在仪表板中选择约会时才会出现此标题,这与此处无关。但是,一旦我注销并重新登录,未选择患者,将显示标题视图。我认为这是因为我没有释放约会对象,我也不确定如何做到这一点(我是iOS编程的新手)。
这是我的代码:
所以我有界面
@interface DashboardVC : CommonVC <UIActionSheetDelegate, HeaderViewDelegate, PracticeServiceDelegate> {
IBOutlet HeaderView *_headerView;
}
在HeaderView对象中,我有以下属性:
@property (strong, nonatomic) CCAppointment *appointment;
@property (strong, nonatomic) IBOutlet UIButton *backButton;
@property (strong, nonatomic) IBOutlet UIView *currentPatientView;
@property (strong, nonatomic) IBOutlet UIImageView *avatarImageView;
@property (strong, nonatomic) IBOutlet UILabel *patientNameLabel;
然后,我在仪表板VC中想要取消分配,但我不确定如何...这就是我所拥有的:
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
如何解除分配属性以使headerVIew不显示?
答案 0 :(得分:2)
if you want to destroy _headerView try:
[_headerView removeFromSuperview];
_headerView = nil;