gpt4 book ai didi

ios - 如何在选项卡之间切换并直接显示推送的 View Controller ?

转载 作者:行者123 更新时间:2023-11-29 00:56:51 25 4
gpt4 key购买 nike

这是我的代码:

  VideoDetailViewController *VideoDetailVC = [self.storyboard instantiateViewControllerWithIdentifier:@"VideoDetailViewController"];

UINavigationController * navigationController = (UINavigationController *) [[self tabBarController] selectedViewController];

[self.tabBarController setSelectedIndex:0];

[navigationController pushViewController:VideoDetailVC animated:YES];

我正在选项卡栏的第二个索引中编写此代码。我想直接进入视频详细信息屏幕,它是选项卡栏零索引的 subview Controller 。一切正常,但我看到的是:它显示了一个父 View Controller ,它是选项卡栏的零索引。一秒钟后,它会推送到视频详细信息屏幕。我只是不想显示零索引。解决办法是什么?帮助将不胜感激。

编辑:

#import "TWPhotoCollectionViewCell.h"

@implementation TWPhotoCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.imageView = [[UIImageView alloc] initWithFrame:self.bounds];
self.imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.imageView.layer.borderColor = [UIColor blueColor].CGColor;
[self.contentView addSubview:self.imageView];
}
return self;
}

- (void)setSelected:(BOOL)selected {
[super setSelected:selected];

self.imageView.layer.borderWidth = selected ? 2 : 0;
}

@end

最佳答案

替换下一行

  [navigationController pushViewController:VideoDetailVC animated:YES];

  [navigationController pushViewController:VideoDetailVC animated:NO];

它可能会解决您的问题。

关于ios - 如何在选项卡之间切换并直接显示推送的 View Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37541941/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com