WuKong94/DD-Demo

FirstVC点击tabbarItem有层级问题

Opened this issue · 0 comments

- (void)selectTabBarIndex:(NSInteger)index{
    if (index >= self.vcArray.count) {
        return;
    }
    NSString *vcName = self.vcArray[index];
    if ([[self.vcMap allKeys] containsObject:vcName]) {
        UIViewController *vc = self.vcMap[vcName];
        [self.contentView bringSubviewToFront:vc.view];
    }else{
        UIViewController *vc = [[self.vcArray[index] alloc] init];
        [self addChildViewController:vc];
        [self.contentView addSubview:vc.view];
        [self.vcMap setValue:vc forKey:NSStringFromClass(self.vcArray[index])];
    }
}

image