LoginController
尝试一个简单的登录尝试——如果成功,它会调用setEmail
.leftcontroller
setEmail
当被调用时,我需要做的就是隐藏btnLogin
并显示,buttonUser
而我没有尝试任何工作。s被NSLog
调用并且EventsController
负载setEmail
正常工作 - 它只是不会隐藏和显示按钮。
leftcontroller.h
:
@interface LeftController : UIViewController <UIApplicationDelegate>
{
IBOutlet UIButton *btnLogin;
IBOutlet UIButton *buttonUser;
NSString *setEmail;
}
@property (nonatomic,strong) IBOutlet UIButton *btnLogin;
@property (nonatomic,strong) IBOutlet UIButton *buttonUser;
@property(nonatomic,strong) UITableView *tableView;
@property(nonatomic) NSString *Email;
//-(void) setEmail : (NSString *) Email;
@end
leftcontroller.m
:
- (void) setEmail : (NSString * ) Email{
[buttonUser setTitle:Email forState:UIControlStateNormal];
//btnLogin.hidden = YES;
//buttonUser.hidden = NO;
[btnLogin setHidden:YES];
[buttonUser setHidden:NO];
NSLog(@"Set Email Called");
NSLog(@"email: %@", Email);
DDMenuController *menuController = (DDMenuController*)((AppDelegate*)[[UIApplication sharedApplication] delegate]).menuController;
EventsViewController *controller = [[EventsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[menuController setRootController:navController animated:YES];
}
-(void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = HEXCOLOR(0x000000);
btnLogin = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btnLogin.frame = CGRectMake(0, 0, 180.f, 48);
[btnLogin setTitle:@"Login" forState:UIControlStateNormal];
[btnLogin addTarget:self action:@selector(LoginPressed)
forControlEvents:UIControlEventTouchUpInside];
btnLogin.tag=1;
btnLogin.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[btnLogin setTitleColor: [UIColor whiteColor] forState:UIControlStateNormal];
btnLogin.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
UIImage *btnImage = [UIImage imageNamed:@"nav_top.png"];
[btnLogin setBackgroundImage:btnImage forState:UIControlStateNormal];
[self.view addSubview:btnLogin];
buttonUser = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonUser.frame = CGRectMake(0, 0, 180.f, 48);
//[buttonUser setTitle:_Email forState:UIControlStateNormal];
[buttonUser addTarget:self action:@selector(EmailPressed)
forControlEvents:UIControlEventTouchUpInside];
buttonUser.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[buttonUser setTitleColor: [UIColor whiteColor] forState:UIControlStateNormal];
buttonUser.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
UIImage *btnImage1 = [UIImage imageNamed:@"nav_top.png"];
[buttonUser setBackgroundImage:btnImage1 forState:UIControlStateNormal];
[self.view addSubview:buttonUser];
buttonUser.hidden = YES;
}