热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Xcode8.3.2游乐场实时视图渲染不起作用

如何解决《Xcode8.3.2游乐场实时视图渲染不起作用》经验,为你挑选了1个好方法。

此代码在以前版本的Xcode中完美运行,但现在它没有显示任何内容.它只显示活动指示器显示"正在运行的项目"

import UIKit
import PlaygroundSupport

let cOntainer= UIView()
container.frame.size = CGSize(width: 215.0, height: 215.0)

var view = UIView()
view.frame.size = CGSize(width: 185.0, height: 185.0)
view.center = container.center
view.layer.cornerRadius = view.frame.size.height/2
view.backgroundColor = UIColor.white

container.addSubview(view)

let scaleAnimation = CABasicAnimation(keyPath: "transform.scale")
scaleAnimation.fromValue = CGFloat(0.6)
scaleAnimation.toValue = CGFloat(1.15)
scaleAnimation.timingFunction = CAMediaTimingFunction(name:    kCAMediaTimingFunctionEaseOut)
scaleAnimation.isRemovedOnCompletion= false

let opacityAnimation = CABasicAnimation(keyPath: "opacity")
opacityAnimation.fromValue = CGFloat(0.0)
opacityAnimation.toValue = CGFloat(0.1)
opacityAnimation.duration = 1
opacityAnimation.isRemovedOnCompletion= false
opacityAnimation.autoreverses = true;


let circleAnimations: CAAnimatiOnGroup= CAAnimationGroup()
circleAnimations.duration = 2
circleAnimations.repeatCount = HUGE;
circleAnimations.animatiOns= [scaleAnimation, opacityAnimation];

view.layer .add(circleAnimations, forKey: "circleAnimations")

PlaygroundPage.current.liveView = container
PlaygroundPage.current.needsIndefiniteExecution = true

这有什么问题?



1> 小智..:

您需要启用助理编辑器才能查看结果.

查看>助理编辑器>显示助理编辑器

另请参见此处: iOS Playground不显示UI预览 在此输入图像描述


推荐阅读
author-avatar
飞龙在天2602911735
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有