- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *dic = [[NSDictionary alloc]init];
if (self.globleArray.count > 0) {
dic = self.globleArray[indexPath.row];
} else {
dic = self.tempArray[indexPath.row];
}
if ([dic objectForKey:@"children"] != nil) {
NSMutableDictionary *tempDic = [[NSMutableDictionary alloc]init];
[tempDic setObject:[dic objectForKey:@"children"] forKey:[dic objectForKey:@"id"]];
BranchViewController *branch = [[BranchViewController alloc]init];
branch.globleArray = [dic objectForKey:@"children"];
[self.navigationController pushViewController:branch animated:YES];
} else {
NSNotification *noti = [[NSNotification alloc]initWithName:@"branch" object:self.branchArray[indexPath.row] userInfo:nil];
[[NSNotificationCenter defaultCenter] postNotification:noti];
for (UIViewController *controller in self.navigationController.viewControllers) {
if ([controller isKindOfClass:[ChooseBranchViewController class]]) {
ChooseBranchViewController *messageVC =(ChooseBranchViewController *)controller;
[self.navigationController popToViewController:messageVC animated:YES];
}else{
}
}
}
}