某幾個項目不能選擇時,
只需將該項目setEnable:NO,
這樣就行了。
[[self.tabBarController.tabBar.items objectAtIndex:3] setEnabled:NO];
[[self.tabBarController.tabBar.items objectAtIndex:3] setEnabled:NO];
//關閉編輯功能 self.tabBarController.customizableViewControllers = nil; //變更標題 self.tabBarController.moreNavigationController.navigationBar.topItem.title = @"自訂"; //改變顏色 self.tabBarController.moreNavigationController.navigationBar.tintColor = [UIColor blackColor];
//建立掃描畫面 ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO]; [widController.overlayView setDisplayedMessage:@"請將條碼圖示置於框線內"]; //Barcode Reader QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init]; NSSet *readers = [[NSSet alloc ] initWithObjects:qrcodeReader,nil]; [qrcodeReader release]; widController.readers = readers; [readers release]; //掃瞄完成時,聲音提示 NSBundle *mainBundle = [NSBundle mainBundle]; widController.soundToPlay =[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO]; //將描畫面加入主畫面 [self presentModalViewController:widController animated:YES]; [widController release];
- (IBAction)loginButtonPressed:(id)sender {
NSLog(@"[userNameTextField text] = %@",[userNameTextField text]);
NSLog(@"[passwordTextField text] = %@",[passwordTextField text]);
if ([[userNameTextField text] isEqualToString:userName] && [[passwordTextField text] isEqualToString:password]) {
[self performSegueWithIdentifier:@"loginSuccess" sender:self];
} else {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Login Fail" message:@"Please Check Your User Name or Password.\n It's Wrong." delegate:self cancelButtonTitle:@"OK!" otherButtonTitles:nil, nil ];
[alertView show];
}
}
另外如果希望再切換畫面前在做某些事
可以實現以下Method
- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender
{
//寫上你想執行的...
}