iphone - 有没有办法让 App Delegate 运行条件然后选择 Storyboard入口点?
<p><p>如果我使用的是 Storyboard并且入口点是 viewController1。 </p>
<p>有没有办法让 App Delegate 运行条件,然后选择 Storyboard 入口点 - viewController1 或 viewController2?</p>
<p>我想从 App Delegate 中选择是否打开位置服务,然后执行以下操作:</p>
<pre><code> (!)
{
self.viewController = [ init];
NSLog(@"vc is viewController2 from app del. loc svcs off");
}
else if ()
{
// alert location services denied
self.viewController = [ init];
NSLog(@"vc is viewController2 from app del. loc svcs on");
NSLog(@"core location is on");
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>是的,你可以这样做。</p>
<p>用以下方法写下你的条件:</p>
<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
</code></pre>
<p>做这样的事情</p>
<pre><code>if(Con1)
{
window.rootViewController = ;
}
else
{
window.rootViewController = ;
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - 有没有办法让 App Delegate 运行条件然后选择 Storyboard入口点?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/14750354/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/14750354/
</a>
</p>
页:
[1]