xcode – 从Playground运行的模拟器中闪烁的UIView
|
我正在运行一个游乐场,Xcode 6.3(6D543q).因此
Swift 1.2
Playground导入XCPlayground. UIAlertView正常显示. 代码如下…… // 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))
从this post(他们的动画确实出现但闪烁,重叠)
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
