我正在使用UITableView多部分列表。我看到的问题是每个部分的单元格上方有一个空格,即使我设置tableView(_:heightForHeaderInSection:)为 0。即使只有一个部分并且我设置tableView(_:viewForHeaderInSection:)为,也会发生这种情况nil。
我已经尝试了 StackOverflow 上与插入覆盖/边缘扩展相关的所有其他答案,但没有一个有效。
例子:
我是Sinatra的新手,我正在尝试使用SQLite3和Datamapper创建数据库.我安装了gems和适配器,然后尝试在文件中执行此代码:
#config
require 'sinatra'
require 'sinatra/contrib' if development?
require 'data_mapper'
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/recall.db")
DataMapper.finalize.auto_upgrade!
Run Code Online (Sandbox Code Playgroud)
执行文件时,命令行给了我这个错误:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found. -
C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)
Run Code Online (Sandbox Code Playgroud)
然后由于这些错误而导致许多其他问题.我尝试重新安装许多宝石,但似乎没有任何效果.
编辑:完整的错误代码是这样的:
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':126: The specified module could not be found. - C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3/1.9/do_sqlite3.so (LoadError)
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:31:in `rescue in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/do_sqlite3-0.10.10-x86-mingw32/lib/do_sqlite3.rb:26:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter/adapter.rb:1:in `<top (required)>'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/backports-2.6.5/lib/backports/tools.rb:314:in `require_with_backports'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dm-sqlite-adapter-1.2.0/lib/dm-sqlite-adapter.rb:1:in …Run Code Online (Sandbox Code Playgroud) 我试图通过滚动来控制视频,以便当用户向下移动页面时,视频也会随着滚动而移动。为此,我向滚动事件添加了一个事件处理程序,该事件处理程序更新了视频元素的currentTime属性。当使用Safari(11.0.2)时,动画是平滑的,但是在Chrome(63)或Firefox上,该帧仅在惯性滚动结束时更新。我可以通过将视频的水平分辨率降低到600px来平滑动画。这仅仅是性能不同的产品吗,还是我的代码存在一些特定于浏览器的优化问题?
注意:我使用Mac进行了多点触控平滑滚动测试。不知道是否使用滚轮可以明显看出这种现象。
下面是使用的js和示例的链接:
var total, video;
window.onload = function() {
video = document.getElementById("video");
// Should react to scrolling until halfway down the video.
total = video.scrollHeight/2 + document.getElementById('top').scrollHeight;
window.addEventListener("scroll", animateGoat, false);
};
function animateGoat(ev) {
var scroll = window.pageYOffset ||
document.documentElement.scrollTop ||
document.body.scrollTop || 0;
// Updates the video to the time with the same fraction of completion as the scroll.
video.currentTime = scroll <= total ? 2 * scroll / total : 2;
}
Run Code Online (Sandbox Code Playgroud)
我有一个带有固定导航栏的站点,该栏位应该与页面一起滚动.当我添加JS Google Map时,导航栏不再移动:
http://amosjackson.com/map/index.html
此外,只有在地图绝对定位时才会出现此问题.
当我使用if/elseSinatra命令的缩写语句时,我收到语法错误:
request.cookies['blog'].nil? ? erb :blog : redirect '/done'
Run Code Online (Sandbox Code Playgroud)
返回此错误:
/home/sinatra/ptt/ptt.rb:107: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' request.cookies['blog'].nil? ? "erb :blog" : redirect '/done' ^
Run Code Online (Sandbox Code Playgroud)
这两个语句本身都会产生错误(没有Sinatra代码作为另一个语句).
这是一个Sinatra问题还是语法不正确?
当true/false语句是纯Ruby时,不会发生错误:
request.cookies['blog'].nil? ? foo = 1 : bar = 2
Run Code Online (Sandbox Code Playgroud) javascript ×2
ruby ×2
css ×1
datamapper ×1
google-maps ×1
html5-video ×1
ios ×1
sinatra ×1
swift ×1
uikit ×1
uitableview ×1