我一直在使用他们建议的桥接头在Swift中尝试使用XLForms。
我已经加载了XLForms Pod并添加了桥文件并在Swift Compiler中引用了它。 Bridge文件引用包括#import <XLForm/XLForm.h>
。
然而,当我尝试编译我的项目时,我得到了
使用未声明的类型&#39; XLFormViewController&#39;
我认为这意味着Swift无法访问该库。
我尝试了不同版本并再次尝试设置,但我似乎无法找到它。如果我将#import <XLForm.h>
更改为#import <XLForm/XLForm.h>
,Xcode会警告我无法找到该文件,因此我知道Xcode正在使用public Class calcuTESTForm1
Private isDotExixtsbool As Boolean
Private isFirstnumbool As Boolean
Private FirstNumDecimal As Boolean
Private SecondNumberdecimal As Boolean
Private oPeratorString As String
Private Sub btnone_Click(sender As Object, e As EventArgs) Handles btnone.Click
RemoveZero(1)
End Sub
Private Sub Btntwo_Click(sender As Object, e As EventArgs) Handles Btntwo.Click
RemoveZero(2)
End Sub
Private Sub Btnthree_Click(sender As Object, e As EventArgs) Handles Btnthree.Click
RemoveZero(3)
End Sub
Private Sub btnfour_Click(sender As Object, e As EventArgs) Handles btnfour.Click
RemoveZero(4)
End Sub
Private Sub btn5_Click(sender As Object, e As EventArgs) Handles btn5.Click
RemoveZero(5)
End Sub
Private Sub Buttonsix_Click(sender As Object, e As EventArgs) Handles Buttonsix.Click
RemoveZero(6)
End Sub
Private Sub btnseven_Click(sender As Object, e As EventArgs) Handles btnseven.Click
RemoveZero(7)
End Sub
Private Sub Buttoneight_Click(sender As Object, e As EventArgs) Handles Buttoneight.Click
RemoveZero(8)
End Sub
Private Sub ButtonNine_Click(sender As Object, e As EventArgs) Handles ButtonNine.Click
RemoveZero(9)
End Sub
Private Sub btnzero_Click(sender As Object, e As EventArgs) Handles btnzero.Click
RemoveZero(0)
End Sub
Private Sub Buttonbot_Click(sender As Object, e As EventArgs) Handles Buttonbot.Click
If isDotExixtsbool = False Then
lblDisplay.Text &= "."
isDotExixtsbool = False
End If
End Sub
Private Sub CalcuTESTform1(sender As Object, e As EventArgs) Handles MyBase.Load
isDotExixtsbool = False
isFirstnumbool = False
End Sub
'Remove zero at the start of number
Public Sub RemoveZero(ByVal number As Integer)
If lblDisplay.Text = "0" Then
lblDisplay.Text = number
Else
lblDisplay.Text &= number
End If
End Sub
Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btn4.Click
lblDisplay.Text = ""
lblDisplay.Text = 0
isDotExixtsbool = True
End Sub
Private Sub minusandadd_Click(sender As Object, e As EventArgs) Handles minusandadd.Click
End Sub
Private Sub Buttonplus_Click(sender As Object, e As EventArgs) Handles Buttonplus.Click
oPeratorString = "+"
IsFirstNumberAvailable()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles equalbutton.Click
' only do ,if first number is available
If isFirstnumbool Then
secondNumberdecimal = CType(lblDisplay.Text, Decimal)
End If
Dim resultDecimal As Decimal
Select Case oPeratorString
Case Is = "+"
resultDecimal = FirstNumDecimal + SecondNumberdecimal
Case Is = "-"
resultDecimal = FirstNumDecimal - SecondNumberdecimal
Case Is = "/"
resultDecimal = FirstNumDecimal / SecondNumberdecimal
Case Is = "*"
resultDecimal = FirstNumDecimal * SecondNumberdecimal
End Select
'now Calculate the Result
'calculateResult(FirstNumDecimal, SecondNumberdecimal, oPeratorString, resultDecimal)
'show the result in the textbox
lblDisplay.Text = resultDecimal.ToString()
End Sub
Private Sub calculateResult(ByVal aFirstNumDecimal As Decimal,
ByVal aSecondNumberdecimal As Decimal,
ByVal aOperator As String,
ByRef aResult As String)
MessageBox.Show(aFirstNumDecimal)
Select Case aOperator
Case Is = "+"
aResult = aFirstNumDecimal + aSecondNumberdecimal
Case Is = "-"
aResult = aFirstNumDecimal - aSecondNumberdecimal
Case Is = "/"
aResult = aFirstNumDecimal / aSecondNumberdecimal
Case Is = "*"
aResult = aFirstNumDecimal * aSecondNumberdecimal
End Select
End Sub
Public Sub IsFirstNumberAvailable()
' only do it, if first Num is not available
If isFirstnumbool = False Then
' Save the current number to firstNumDecimal
firstNumDecimal = CType(lblDisplay.Text, Decimal)
' Make first Num is available
isFirstnumbool = True
' Reset the lblDisplay.Text to enter 2nd Number
lblDisplay.Text = "0"
End If
End Sub
Private Sub Buttonmlt_Click(sender As Object, e As EventArgs) Handles Buttonmlt.Click
oPeratorString = "*"
IsFirstNumberAvailable()
End Sub
Private Sub Buttonmulty_Click(sender As Object, e As EventArgs) Handles Buttonmulty.Click
oPeratorString = "/"
IsFirstNumberAvailable()
End Sub
Private Sub ButtonMnus_Click(sender As Object, e As EventArgs) Handles ButtonMnus.Click
oPeratorString = "-"
IsFirstNumberAvailable()
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
If lblDisplay.Text < " " Then
lblDisplay.Text = Mid(lblDisplay.Text, 1, Len(lblDisplay.Text) - 1 + 1)
Else
lblDisplay.Text = Mid(lblDisplay.Text, 1, Len(lblDisplay.Text) - 1)
End If
End Sub
End Class
找到它...只是不允许我使用它
有什么建议吗?
编辑:我尝试过包含另一个图书馆,但我遇到了同样的问题。是否还有使用Bridge Header的其他步骤?答案 0 :(得分:1)
使用
import XLForm
解决了问题。