ios - 从 appdelegate 展示一个 View Controller

标签 ios objective-c appdelegate

我没有使用 LaunchScreen.xib 。我正在将 Storyboard 用于启动画面。我正在调用 API 来获取启动图像。我在应用程序委托(delegate)中这样做。我可以在我的 View Controller 上显示图像,但是一旦我显示我的图像,我就无法转到另一个 Controller 。

这是我在 AppDelegate 中的内容:

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{


self.window.frame=CGRectMake(0, 200, 100,30);

[self.window addSubview:[self convertImage: image]];

//upto here everything is fine

//now i am trying to wait for 3 seconds and call another view controller

sleep(3);

ViewController *login=[[ViewController alloc]initWithNibName:@"Login" bundle:nil];
[self presentviewcontroller:....]; // not able to present another controller

}

最佳答案

你可以使用:

[[self window].rootViewController presentViewController:login animated:YES completion:nil];

关于ios - 从 appdelegate 展示一个 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28464789/

相关文章:

ios - iOS 上的 RSA 加密 (RSA/ECB/PKCS1Padding)

ios - 从应用委托(delegate)获取当前 View Controller

iphone - 不确定如何修复此 EXC_BAD_ACCESS 错误

objective-c - ivar 的分配不起作用

ios - 使用 Google Maps iOS SDK 1.4 设置 mapView.delegate

ios - Swift - 从一年中的某一天获取日期

ios - UILocalNotification 的 alertTitle 属性不起作用

Swift - AVAudioPlayer,声音无法正确播放

Swift:呈现主要和替代(登录/入职)流程时出现视觉故障?

ios - 创建精简版,使用多个目标,如何避免覆盖完整版?