我指的是来自 GitHub 的项目。
我正在尝试根据我的要求对其进行修改,但我没有得到并且无法理解我必须在didSelectRowAtIndexPath
方法中编写什么代码。
我想要的是在单击 tableView 行后它可以是 0 级或 1 级(here level 0 means - row has no sub child and level 1 means row has subview/child rows )
当我单击级别 0 或级别 1 的任何 tableView 行时,它必须导航到下一个 viewController。
在此示例中,第 2 行和第 3 行是可扩展的,即它包含 1 级行,第 0、1、4 和 5 行是它们不扩展的第 1 级行。
***** 添加代码 ****
我在 AppDelegate 类中编写的代码,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
userDefaults=[NSUserDefaults standardUserDefaults];
mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"loginSuccess"]) {
NSLog(@"Login Done!!!");
HomeViewController *homeVC=[mainStoryboard instantiateViewControllerWithIdentifier:@"homeId"];
SampleNavigationController *navigation = [[SampleNavigationController alloc] initWithRootViewController:homeVC];
//SWRevealViewController * vc= [[SWRevealViewController alloc]init];
//ExpandableTableViewController *sidemenu = (ExpandableTableViewController*)[mainStoryboard instantiateViewControllerWithIdentifier:@"sideMenu"];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
}else
{
LoginViewController *loginVC=[mainStoryboard instantiateViewControllerWithIdentifier:@"LoginId"];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = loginVC;
[self.window makeKeyAndVisible];
}
return YES;
}
在 LoginViewController 类中,我编写了代码
- (IBAction)loginButtonMethod:(id)sender {
[self->userdefaults setBool:YES forKey:@"loginSuccess"];
InboxView *inboxVC=[self.storyboard instantiateViewControllerWithIdentifier:@"id1"];
[self.navigationController pushViewController:inboxVC animated:YES];
[[self navigationController] setNavigationBarHidden:NO];
}