0
我使用rubymotion与promotion框架来开发我的第一个iOS应用程序。我有一个表格视图(内部导航控制器),点击表格单元格打开新的屏幕与Web视图加载本地HTML文件。问题是Web视图仅在第一次加载时显示。当我返回(导航控制器)并再次点击任何单元时,它会打开新的屏幕,但不会显示网络视图。 Web视图委托方法被触发,所以它加载它,但我只看到黑屏(带有导航栏)。从UITableView加载UIWebView只能第一次工作
这是一个有网络视图的画面代码:
class XXXDetailScreen < ProMotion::Screen
attr_accessor :screen_title
def on_load
XXXDetailScreen.title = self.screen_title
@web_view = add_element UIWebView.alloc.initWithFrame(self.view.bounds)
@web_view.delegate = self
@web_view.scrollView.scrollEnabled = false
@web_view.scrollView.bounces = false
@web_view.loadRequest(NSURLRequest.requestWithURL(NSURL.fileURLWithPath(NSBundle.mainBundle.pathForResource('index', ofType: 'html', inDirectory: 'html'))))
end
def webView(inWeb, shouldStartLoadWithRequest: inRequest, navigationType: inType)
true
end
end
屏幕上方开放与此代码:
def tableView(tableView, didSelectRowAtIndexPath: indexPath)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
open GalleryDetailScreen.new(screen_title: @data[indexPath.row][:title]), hide_tab_bar: true
end
感谢您的任何建议
Jamon,感谢您的帮助和您在ProMotion上的工作!它使RubyMotion的开发更愉快:) – 2013-03-01 17:04:15
很高兴听到!那么它的工作,然后呢? – 2013-03-01 17:58:00