我创建了一个带静音的简单视频块(用于移动自动启动),但现在我无法改变静音状态......
我使用那个存储库,小提琴链接会很棒.
到目前为止,我已经尝试过,没有运气.
HTML
<video width="640" height="264" muted autoplay webkit-playsinline src="'+videoURL+'"></video>'
Run Code Online (Sandbox Code Playgroud)
JS
$(document).on("click",".containerVolume",function(e){
if(isMuted){
$('video').prop('muted', false);
}
else{
$('video').prop('muted',true);
}
});
var videos = document.querySelectorAll('video');
if (location.search === '?enabled=false')
{
} else if (location.search === '?enabled=true') {
enableVideos(false);
} else {
enableVideos();
}
function enableVideos(everywhere) {
for (var i = 0; i < videos.length; i++) {
window.makeVideoPlayableInline(videos[i], !videos[i].hasAttribute('muted'), !everywhere);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用TableViewCell扩展的自定义cocoa类,它不会给出任何错误消息,但单元格不会出现在tableview中.滚动变长但表格单元格不可见.
我在我的ViewController中键入了这个:
tableView.registerClass(CustomTableViewCell.self, forCellReuseIdentifier: "Cell")
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)->UITableViewCell
{
var cell:CustomTableViewCell? = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as? CustomTableViewCell
if cell == nil {
cell = CustomTableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell")
}
cell!.labTime.text = filtered[indexPath.row].name!
return cell!
}
Run Code Online (Sandbox Code Playgroud)
我的细胞类看起来像
var labTime = UILabel()
override func awakeFromNib() {
// Initialization code
super.awakeFromNib()
labTime = UILabel(frame: contentView.bounds)
labTime.font = UIFont(name:"HelveticaNeue-Bold", size: 16)
contentView.addSubview(labTime)
}
Run Code Online (Sandbox Code Playgroud)
我不使用任何storyBoard或xib文件.找不到解决方案,谢谢