我正在尝试将VC推送到其他VC。到目前为止,我已经处理了WITH cte AS (
SELECT AVG(height) a, STDDEV(height) sd
FROM people
)
SELECT AVG(height)
FROM people
WHERE height BETWEEN (SELECT a-2*sd FROM cte) AND (SELECT a+2*sd FROM cte);
个文件。因此,现在转到情节提要,我遇到了一个小问题。我有两个情节提要.xib
和A.storyboard
我尝试过的是:
B.storyboard
这对我来说很好,但是我担心内存泄漏。我知道并喜欢的另一种方式是:
let storyBoard: UIStoryboard = UIStoryboard(name: storyboard, bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: storyboardId)
controller.present(newViewController, animated: true, completion: nil)
但是,当我使用此^时,黑屏却什么也没有。为什么推送在这里不起作用,但是在self.navigationController?.pushViewController(LoginController(), animated: true)
中对我来说效果很好?
答案 0 :(得分:0)
您的第一个代码是正确的,但不是强制性的,而是一个礼物。因此,您应该这样更改代码:
Sub subTest()
Dim arrStrings() As String
For i = 1 To 6
ReDim Preserve arrStrings(1 To i) ' Extend the array - 'preserve' retains the old values too
arrStrings(i) = "this is string " & i
Next i
For Each strValue In arrStrings
Debug.Print (strValue) ' Just so we see each string
Next strValue
Debug.Print (fncDoSomething(arrStrings)) ' Passing string array as parameter
End Sub
' Example function which counts how many characters are in your array.
Function fncDoSomething(ByRef strings() As String) As Integer ' ByRef is important when passing an array.
Dim intCharCount As Integer
Dim strValue As Variant
intCharCount = 0
For Each strValue In strings
intCharCount = intCharCount + Len(strValue)
Next strValue
fncDoSomething = intCharCount
End Function
第二个代码的问题是let storyBoard: UIStoryboard = UIStoryboard(name: storyboard, bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: storyboardId)
self.navigationController?.pushViewController(newViewController, animated: true, completion: nil)
不是情节提要中的登录控制器—只是一个新的空白LoginController。