从当前控制器切换控制器-笔记

2018-03-22  本文已影响9人  姚姚先生
- (void)requestProductDetails
{
    NSString *urlStr = [NSString stringWithFormat:@"%@mobile/product/new/%@.json", YJJUrlHttpHost, self.productId];
    [SVProgressHUD show];
    [[YJJNetwork shareNetWork] GET:urlStr
                      parameterDic:nil
                        completion:^(YJJResponse *response) {
                            if (response.status == YJJResponseStatusSuccess)
                            {
                                [SVProgressHUD dismiss];
                                id permissionValue = response.data[@"hasPermission"];
                                if (permissionValue && [NSString stringWithFormat:@"%@", permissionValue].integerValue == 0) {
                                    YJJProductNoPermissionViewController *vc = [[YJJProductNoPermissionViewController alloc] init];
                                    vc.hidesBottomBarWhenPushed = YES;
                                    NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray:self.navigationController.viewControllers];
                                    [viewControllers replaceObjectAtIndex:viewControllers.count - 1 withObject:vc];
                                    [self.navigationController setViewControllers:viewControllers animated:NO];
                                    return;
                                }
                                
                                self.stockProduct = [[YJJStockProduct alloc] initWithDictionary:response.data];

                                [self initialzation];
                                [self updateMainViews];
                                [self voucherButtonClick:self.stockProduct.brand.brandId];
                            }
                            else
                            {
                                [SVProgressHUD showErrorWithStatus:response.errorMsg];
                            }
                        }];
}

摘要

if (permissionValue && [NSString stringWithFormat:@"%@", permissionValue].integerValue == 0) {
                                    YJJProductNoPermissionViewController *vc = [[YJJProductNoPermissionViewController alloc] init];
                                    vc.hidesBottomBarWhenPushed = YES;
                                    NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray:self.navigationController.viewControllers];
                                    [viewControllers replaceObjectAtIndex:viewControllers.count - 1 withObject:vc];
                                    [self.navigationController setViewControllers:viewControllers animated:NO];
                                    return;
                                }
上一篇 下一篇

猜你喜欢

热点阅读