- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我已经在网络和 Stack Overflow 上搜索了几个小时,但我无法解决这个问题。希望你们都能看到我的错误,因为我就是找不到它。
我有一个简单的基于 Storyboard的应用程序,我刚刚开始。初始 ViewController 是 UITabBarController 的一个实例,带有模板中的两个虚拟 ViewController。启动后,我需要检查设备是否登录到外部服务。如果没有,我将显示一个允许用户进行身份验证的模态 ViewController,如果设备已通过身份验证,那么我将只显示 FirstViewController。
以下步骤是我创建项目以来所做的一切:
viewDidLoad
手动调用 segue当我运行应用程序时,模式转场没有触发,显示了 UITabBarController 的第一个 ViewController,我在 XCode 中得到以下输出:
Warning: Attempt to present <AuthenticateViewController: 0x83c0c10> on <EPTabBarController: 0x83be600> whose view is not in the window hierarchy!
下面的相关代码,实际上是我到目前为止添加的唯一代码。请让我知道屏幕截图或其他信息是否有用。预先感谢您的帮助。
EPTabBarController,UITabBarController 的子类:
#import "EPTabBarController.h"
#import "AuthenticateViewController.h"
@interface EPTabBarController ()
@end
@implementation EPTabBarController
- (void)viewDidLoad
{
[super viewDidLoad];
[self performSegueWithIdentifier:@"authenticationSegue" sender:self];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
最佳答案
问题在里面
- (void)viewDidLoad
{
[super viewDidLoad];
[self performSegueWithIdentifier:@"authenticationSegue" sender:self];
}
您正在尝试呈现另一个 View (AuthenticateViewController
),而您的当前 View (EPTabBarController
)尚未加载到窗口层次结构中。
因此,首先让您的 EPTabBarController
加载到窗口层次结构中,然后呈现 AuthenticateViewController
。
试一试
- (void)viewDidLoad
{
[super viewDidLoad];
[self performSelector:@selector(loadAuthenticateViewController)
withObject:nil
afterDelay:1.0];
}
-(void)loadAuthenticateViewController
{
[self performSegueWithIdentifier:@"authenticationSegue" sender:self];
}
关于ios - 手动模态 segue 不起作用,View Controller 不在窗口层次结构中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15607821/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!