我在 Visual Studio 2015 中使用 Cordova 应用程序。我添加了一个简单的按钮,可将应用程序的背景颜色更改为红色。但它给出了上述错误。
索引.html
<!DOCTYPE html>
<html>
<head>
<!--
Customize the content security policy in the meta tag below as needed. Add 'unsafe-inline' to default-src to enable inline JavaScript.
For details, see http://go.microsoft.com/fwlink/?LinkID=617521
-->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>WeatherApp</title>
</head>
<body>
<p>Hello World</p>
<input type="button" name="color" value="Change Color" id="color" onclick="changeColor()"> …Run Code Online (Sandbox Code Playgroud) 实现闪烁动画时,不会在 UITableViewCell 上执行任何操作,它开始闪烁,正常但不可点击或可滑动。我尝试了一些解决方案,但无法修复。代码如下。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
cell.backgroundColor = UIColor.colorWithHexString(hexStr: "#FDFAEB")
cell.blink()
return cell
}
Run Code Online (Sandbox Code Playgroud)
动画扩展代码:
extension UIView {
func blink() {
self.alpha = 0.5;
UIView.animate(withDuration: 0.7, //Time duration you want,
delay: 0.0,
options: [.curveEaseInOut, .autoreverse, .repeat],
animations: { [weak self] in self?.alpha = 1.0 },
completion: { [weak self] _ in self?.alpha = 0.8 })
}
}
Run Code Online (Sandbox Code Playgroud)
请告诉我,这是什么原因,我该如何解决?