我有3個類。presentModalViewController not responding
第一個控制器是tabbar中的第一個控制器。我正在使用presentModalViewController來顯示登錄屏幕和主屏幕。我有一個presentModalViewController在firstcontrollor中呈現登錄屏幕,並在Loginscreen viewdidload方法中,我有presentModalViewController,它呈現主屏幕。主屏幕presentModalViewController在homePage_Btn_Clicked中被解除,presentModalViewController在login_Btn_Clicked中被解除。我的問題是我的主屏幕從未出現過。任何幫助?我是iPhone開發新手。
//First Controllor
FirstControllor.m
- (void)viewDidLoad
{
[super viewDidLoad];
Accounts_Login *lvc = [[Accounts_Login alloc]initWithNibName:@"Accounts_Login" bundle:[NSBundle mainBundle]];
[self presentModalViewController:lvc animated:NO];
[lvc release];
}
//Login_view class
Login_view.m
- (void)viewDidLoad {
[super viewDidLoad];
Home_Screen *lvc1 = [[Home_Screen alloc]initWithNibName:@"Home_Screen" bundle:[NSBundle mainBundle]];
[self presentModalViewController:lvc1 animated:NO];
[lvc1 release];
user_ID_TextField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"User ID"];
}
-(IBAction) login_Btn_Clicked{
if ([services authenticate:credential_Data]) {
[self dismissModalViewControllerAnimated:YES];
[credential_Data autorelease];
}
//HomePage class
HomePage.m
-(IBAction) homePage_Btn_Clicked:(id) sender{
UIButton *theButton = (UIButton *)sender;
int count;
switch (theButton.tag) {
case 101:
count++;
[self dismissModalViewControllerAnimated:YES];
break;
default:
break;
}
}
請正確格式化這個代碼! – Pripyat
這是更好嗎? – pa12
粗體不能在代碼塊中工作,所以刪除**。只需使用//評論 – Joe