NSRangeException indexOutOfBound

时间:2016-12-14 06:52:15

标签: ios objective-c

我正在使用我在另一个应用程序中创建的代码。在另一个应用程序中,代码工作正常。我所做的是在加载splashViewController时正在下载和缓存slideShow的图像。下载完成后,它将显示mainviewcontroller,它是一个maintainbleviewcontroller。这是我正在使用的代码:

(.*)at(.*)

1 个答案:

答案 0 :(得分:0)

请先对tabbar.items进行计数检查,然后访问所有标签栏项目:

if(tabbar.items.count==tabCount)   //tabCount is number of tabs in your tabbar
{
    UITabBarItem *tabBarItem1 = tabBar.items[0];
    //<remaining code>
}else
{
   //either tabbar is nil or tabbar doesn't not have any tabs, so handle accordingly
}

此外,由于tabbar在另一个应用程序中运行正常,请检查你的StoryBoard是否正确创建并绑定了rootViewController的tabbar。

这是一篇很好的帖子,其中详细介绍了如何使用Storyboard正确创建tabbar,这可以帮助您调试/验证是否正确创建了绑定和segue: https://guides.codepath.com/ios/Using-Tab-Bar-Controllers