【发布时间】:2014-06-09 18:04:18
【问题描述】:
我有一个应用程序,其中用户看到的第一个屏幕具有从服务器获取的数据。该应用程序还有一个启动屏幕,在加载应用程序时会显示。
问题 根据用户的连接时间,加载数据可能需要几秒钟。在这种情况下,启动屏幕出现几秒钟,然后我只看到一个空白(黑色)屏幕再过几秒钟,然后我看到第一个屏幕。我怀疑从服务器获取数据所需的时间会出现空白屏幕。我正在寻找解决此问题的方法
问题
- 可以配置启动屏幕显示的时间长度吗?例如,在获取数据之前,启动屏幕可能会一直显示?
- 是否可以在加载数据时显示某种微调器而不是黑屏?
更新
这就是我加载数据的方式
def self.fetch(client, &block)
client.shared.headers["username"] = App::Persistence["username"]
client.shared.headers["token"] = App::Persistence["sessionId"]
client.shared.get('categories') do |result|
if result.success?
ary = result.object
block.call(ary)
end
end
end
并使用它
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
Color.fetch(AFMotion::Client) do |data|
main_controller = ColorController.alloc.initWithData(data)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(main_controller)
@window.rootViewController.navigationBar.barTintColor = '#DF533B'.to_color
@window.rootViewController.navigationBar.translucent = true
@window.rootViewController.navigationBar.tintColor = UIColor.whiteColor
@window.rootViewController.navigationBar.setTitleTextAttributes({
UITextAttributeTextColor => UIColor.whiteColor
})
end
@window.makeKeyAndVisible
@window.tintColor = '#DF533B'.to_color
end
【问题讨论】:
-
添加一个“等待”视图/视图控制器。
标签: ios ios7 afnetworking rubymotion