在 Visual Studio for Mac(版本 8.10.7)的最新版本中,當我為 Xamarin.iOS 創建本機專案并嘗試訪問情節提要時,它會直接在 Xcode 中打開。
在舊版本中 Main.Storyboard 是在 Visual Studio 中自己打開的,從那里我們設定 ViewController 類的名稱,并在代碼中使用該名稱創建新的 ViewController。但現在因為它直接在 Xcode 中打開。現在我們如何為故事板中的控制元件創建任何 ViewController 類或屬性?
Xamarin 團隊也沒有為此更新提供任何檔案。如果有人知道這件事嗎?
uj5u.com熱心網友回復:
當你創建一個專案時,你的 Main.storyboard 是與 ViewController 鏈接的,你在 Xcode 中打開 Main.storyboard,點擊這個按鈕 First ,然后點擊 Second ,你可以看到 Xcode 將打開鏈接的 ViewController Final
然后你可以長按Ctrl,滑鼠左鍵長按故事板中的Button,將滑鼠移動到ViewController,當你松開滑鼠時,Xcode會顯示視窗讓你命名這個Button,然后在ViewController中生成代碼,當你關閉Xcode時,Visual Studio 將生成此 Button 的代碼。
我向 youtube 制作了視頻如何使用 xamarin.ios 的故事板
如果您不想使用默認的 ViewController 來鏈接故事板,您可以在 VisualStudio 中創建新的 ViewController,然后在此處將其更改為Xcode 中的將類更改為 MyViewController。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/334655.html
標籤:ios 沙马林 xamarin.ios
上一篇:在多個設備之間具有相同的控制寬度
