Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 在操场上运行的模拟器中闪烁的UIView_Xcode_Swift_Swift Playground_Xcplayground - Fatal编程技术网

Xcode 在操场上运行的模拟器中闪烁的UIView

Xcode 在操场上运行的模拟器中闪烁的UIView,xcode,swift,swift-playground,xcplayground,Xcode,Swift,Swift Playground,Xcplayground,我正在运行一个游乐场,Xcode 6.3(6D543q)。因此,Swift 1.2 操场是一个运动场。 我正在创建一个UIView,并调用XCPShowView()将其渲染到模拟器中,而不是在操场中。 我也以同样的方式展示了一个UIAlertView UIAlertView显示为正常。 UIView在大小之间闪烁,大约每秒5次,相当不规则。 我尝试过调整它的大小以满足屏幕的限制,但没有成功 代码如下 // Playground - noun: a place where people can p

我正在运行一个游乐场,Xcode 6.3(6D543q)。因此,Swift 1.2

操场是一个运动场。 我正在创建一个UIView,并调用XCPShowView()将其渲染到模拟器中,而不是在操场中。 我也以同样的方式展示了一个UIAlertView

UIAlertView显示为正常。 UIView在大小之间闪烁,大约每秒5次,相当不规则。 我尝试过调整它的大小以满足屏幕的限制,但没有成功

代码如下

// Playground - noun: a place where people can play

import UIKit
import Foundation
import XCPlayground

 XCPlayground.XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)

@objc class alertHandler: NSObject, UIAlertViewDelegate {

  func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) {
    if buttonIndex > 0 {

     // View things....
     let redRectangleFrame = CGRect(x: 0, y: 0, width: 200, height: 200)
     let redRectangle = UIView(frame: redRectangleFrame)
     redRectangle.backgroundColor = UIColor.redColor()
     redRectangle.setTranslatesAutoresizingMaskIntoConstraints(false)
     XCPShowView("Red Rectangle", redRectangle)

     // Alert view things...
     let recevingAlertView = alertView

     let text = alertView.textFieldAtIndex(0)?.text
     println("\(text!)")
     println("Button \(buttonIndex)")
    }
  }
}

let anAlertHandler = alertHandler()

let status = "Hey there!"
let message = "Do you have a moment to talk about our Lord and Saviour, Cthulhu?"
let cancel = "Sounds wierd"
let ok = "Oooh! Yes"

let alert = UIAlertView(title: status,
                  message: message,
                 delegate: anAlertHandler,
        cancelButtonTitle: cancel,
        otherButtonTitles: ok)
alert.alertViewStyle = UIAlertViewStyle.PlainTextInput
alert.show()

XCPShowView("Alert", alert)

注意到一些测试操场模拟器示例局部出现了一些闪烁(您的示例在我的6.3.2版(6D2105)中崩溃)

从(他们的动画确实出现了,但闪烁,重叠)

在操场上使用UIKit有一些限制和倒退。这个 主要限制是,在中使用“自动布局”时会出现一些问题 操场。某些约束将导致中的运行时异常 增加了编译时间。希望将来能更新Xcode 这将解决这个问题。另一个不利因素是操场的表现 当你在操场上玩的时候。当Xcode与 我在操场后面跑


来自NSCoder之夜的问候。醉的不识字。对不起,好吧,我报了雷达:20256369,运气好吗?我在UIScrollView上也看到了同样的情况。恐怕还没什么,我希望能把它带到WWDC的实验室