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];
}