简体   繁体   English

Xamarin DesignTime自定义控件在XCode中渲染,在DesignTime中编辑控件属性

[英]Xamarin DesignTime Custom Controls Render in XCode, edit control properties in DesignTime

I am developing an application on Xamarin.iOS and MvvmCross platforms. 我正在开发一个关于Xamarin.iOS和MvvmCross平台的应用程序。 I use xib files instead of storyboards for design interfaces (navigation in my app based on ViewModels). 我使用xib文件而不是故事板来设计界面(在我的应用程序中基于ViewModels导航)。 How can I use Xcode's Interface Builder to render my custom controls & edit properties in IB ? 如何使用Xcode的Interface Builder在IB呈现我的自定义控件和编辑属性?

Adding attributes [DesignTimeVisible (true)] for class and [Export ("Counter"), Browsable (true)] for properties does not work for XCode Interface Builder. 为类添加属性[DesignTimeVisible (true)]和为属性添加[Export ("Counter"), Browsable (true)]不适用于XCode Interface Builder。

As far as I know in Objective-C classes there must be set @IBDesignable & @IBInspectable , if you want design time support in Xcode for custom controls. 据我所知,在Objective-C类中,必须设置@IBDesignable@IBInspectable ,如果你想在Xcode中设计时支持自定义控件。

I believe this is not possible with XCode Interface Builder since it needs to build the custom control in order to present it. 我相信这对XCode Interface Builder来说是不可能的,因为它需要构建自定义控件才能呈现它。 And the XCode project generated by Xamarin is not buildable it is used only to track changes and generate C# code. Xamarin生成的XCode项目不可构建,仅用于跟踪更改并生成C#代码。

However you can take a look at the Xamarin Studio's iOS designer . 但是,您可以查看Xamarin Studio的iOS设计器 I think it has the feature you need. 我认为它具有您需要的功能。

Not exactly what you asked for but Xamarin do support basically the same thing, only using their iOS designer (which I have found rather flaky...) 不完全是你要求的,但Xamarin基本上支持相同的东西,只使用他们的iOS设计师(我发现它相当片状......)

https://developer.xamarin.com/guides/ios/user_interface/designer/ios_designable_controls_walkthrough/ https://developer.xamarin.com/guides/ios/user_interface/designer/ios_designable_controls_walkthrough/

edit: I just noticed the guy above also gave the same solution, his link is to the designer docs, mine is to the custom properties walkthrough so i'll leave it up :) 编辑:我刚注意到上面的那个人也提供了相同的解决方案,他的链接是设计师文档,我的是自定义属性演练所以我会留下它:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM