在某种情况下移动到下一个屏幕?
Move to the next screen in a condition?
我不知道该方法是否正确:我对 WebService 进行了 SOAP 调用,该调用是通过按下按钮启动的。调用后,它使用响应进行解析。现在问题来了:如果响应是 "OK",请使用您得到的答案进入下一个屏幕。
我能怎么做?这段代码如下:
func parser(parser: NSXMLParser, foundCharacters string: String?)
{
if currentElementName == "ClientQRCodeMobileResult"
{
var wsResponse = string!
var splittiamo = split(wsResponse) {[=10=] == ";"}
var firstString: String = splittiamo[0]
if splittiamo[0] == "OK"
{
var tmp = splittiamo[1].toInt()
var tmpDouble = Double(tmp!)
var tmpRound = Double(round(1.00*tmpDouble)/100.00)
// Code HERE for next screen.
}
}
}
我不是很清楚你的问题,所以我的回答是假设
var b =string!
func parser(parser: NSXMLParser, foundCharacters string: String?)
{
if firstString == "OK"
{
var tmp = splittiamo[1].toInt()
var tmpDouble = Double(tmp!)
var tmpRound = Double(round(1.00*tmpDouble)/100.00)
// Code HERE for next screen.
b= String(format:"%f", tmpRound)
self.performSegueWithIdentifier("youridntifierName", sender: self)
}
else
{
// failure status
}
}
想传递数据
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if segue.identifier == "youridntifierName" {
let yourNextViewCOntroller = segue.destinationViewController as UIViewController
yourNextViewCOntroller.passString=b
}
在您的 yourNextViewCOntroller
中创建了一个用于传递数据的对象,例如
var passString:String!
我不知道该方法是否正确:我对 WebService 进行了 SOAP 调用,该调用是通过按下按钮启动的。调用后,它使用响应进行解析。现在问题来了:如果响应是 "OK",请使用您得到的答案进入下一个屏幕。 我能怎么做?这段代码如下:
func parser(parser: NSXMLParser, foundCharacters string: String?)
{
if currentElementName == "ClientQRCodeMobileResult"
{
var wsResponse = string!
var splittiamo = split(wsResponse) {[=10=] == ";"}
var firstString: String = splittiamo[0]
if splittiamo[0] == "OK"
{
var tmp = splittiamo[1].toInt()
var tmpDouble = Double(tmp!)
var tmpRound = Double(round(1.00*tmpDouble)/100.00)
// Code HERE for next screen.
}
}
}
我不是很清楚你的问题,所以我的回答是假设
var b =string!
func parser(parser: NSXMLParser, foundCharacters string: String?)
{
if firstString == "OK"
{
var tmp = splittiamo[1].toInt()
var tmpDouble = Double(tmp!)
var tmpRound = Double(round(1.00*tmpDouble)/100.00)
// Code HERE for next screen.
b= String(format:"%f", tmpRound)
self.performSegueWithIdentifier("youridntifierName", sender: self)
}
else
{
// failure status
}
}
想传递数据
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
if segue.identifier == "youridntifierName" {
let yourNextViewCOntroller = segue.destinationViewController as UIViewController
yourNextViewCOntroller.passString=b
}
在您的 yourNextViewCOntroller
中创建了一个用于传递数据的对象,例如
var passString:String!