我的主页有一个工具栏,其中包含三个按钮,通知和登录。我只想在用户进入时显示通知按钮。这是我的代码
//Parent class
@interface Toolbar : UIViewController {
UIToolbar *toolBar;
UIButton *home;
UIButton *notification;
UIButton *login;
BOOL signIn;
}
@property(nonatomic,assign)BOOL signIn;
@property(nonatomic,retain)UIButton *home;
@property(nonatomic,retain)UIButton *notification;
@property(nonatomic,retain)UIButton *login;
@property(nonatomic,retain)UIToolbar *toolBar;
-(IBAction)Home:(id)sender;
-(IBAction)LogIn:(id)sender;
// Toolbar.m
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
if (!signIn) {
[notification setHidden:YES];
[login setHidden:NO];
}else {
[notification setHidden:NO];
[login setHidden:YES];
}
}
//儿童班
@interface LoginScreen:工具栏{
LoginScreen.m
-(IBAction)SignIn{
if ([emailField.text isEqualToString:@"m"] && [passwordField.text isEqualToString:@"a"]) {
NSLog(@"loggedIN");
signIn=YES;
Home *home=[[Home alloc]initWithNibName:@"Home" bundle:nil];
[self.navigationController pushViewController:home animated:YES];
[home release];
}else {
//other condition
}
}
问题是我能够回到家但是signIn条件不起作用。请指导我。感谢..
答案 0 :(得分:1)