Monodevelop 2.8,XCode 3.2.6,Interface Builder:Outlets and Actions [英] Monodevelop 2.8, XCode 3.2.6, Interface Builder: Outlets and Actions
问题描述
编辑:由于我还没有安装XCode 4,我想知道MD 2.8是否与XCode 3.2.6完全兼容。特别是,我能够使用 MT文档中描述的新程序连接Outlets和Actions 一>?
Since I haven't installed XCode 4 yet, I would like to know if MD 2.8 is fully compatible with XCode 3.2.6 or not. In particular, Am I able to connect Outlets and Actions with the new procedure described in MT documentation?
我刚刚安装了MonoDevelop(MD)2.8。它似乎无法正常工作。
I've just installed MonoDevelop (MD) 2.8. It seems not working I was expecting.
在 MD 2.6 中,当我创建一个新的UIViewController时,该控制器如下所示:
In MD 2.6 when I create a new UIViewController, that controller is presented like the following:
- Controller.xib< - 在同一棵树内
- 控制器。 xib.cs
- Controller.xib.designer.cs
此外,如果我打开一个xib文件,Controller.xib,只打开Interface Builder(IB)。如果我向xib添加插座,插件在Controller.xib.designer.cs中可见。
In addition if I open a xib file, Controller.xib, only Interface Builder (IB) is opened. If I add outlets to the xib, the outlets are visible in the Controller.xib.designer.cs.
在 MD 2.8 中创建时一个新的UIViewController,该控制器如下所示:
In MD 2.8 when I create a new UIViewController, that controller is presented like the following:
- Controller.xib< - 不再在同一棵树内
- Controller.cs
- Controller.designer.cs
所以我有两个文件而不是一个。
So I have two files instead of one.
另外如果我打开一个xib文件,Controller.xib,IB和Xcode打开。如果我向xib添加插座,设计师就无法看到插座。
In addition if I open a xib file, Controller.xib, IB and Xcode are opened. If I add outlets to the xib, the outlets aren't visible in the designer.
有什么建议吗?
推荐答案
MonoDevelop 2.8引入了一个新的xib设计器模型以支持Xcode 4.
MonoDevelop 2.8 introduced a new xib designer model in order to support Xcode 4.
不再使用Xcode 4中集成的Interface Builder支持在xib文件中定义类,出口和操作。这就是MonoDevelop不再可能使用从xib文件生成* .xib.designer.cs文件的模型。相反,Interface Builder从Objective-C源代码中读取出口和操作。 MonoDevelop的解决方案是将C#类同步到Objective-C存根。
The Interface Builder integrated in Xcode 4 no longer supports defining classes, outlets and actions in xib files. This measn it's no longer possible for MonoDevelop to use the model where it generated *.xib.designer.cs files from xib files. Instead, Interface Builder reads outlets and actions from Objective-C source code. MonoDevelop's solution to this is to sync C# classes to Objective-C stubs.
当您从MonoDevelop 2.8打开xib文件时,MonoDevelop使用Objective-C创建一个临时Xcode项目存储镜像镜像所有暴露给Objective-C的C#类,即从NSObject继承并使用
[Register(SomeName)]
属性显式注册的类。然后,它会在该项目的上下文中打开xib文件,以便Interface Builder将查看所有可用类型以及它们的出口和操作。如果在Xcode 4中使用其控制拖动系统添加了出口和操作,那么它们会自动导回到MonoDevelop中的* .designer.cs文件中。When you open a xib file from MonoDevelop 2.8, MonoDevelop creates a temporary Xcode project with Objective-C stubs mirroring all the C# classes that are exposed to Objective-C, i.e. the classes that inherit from NSObject and are explicitly registered with a
[Register("SomeName")]
attribute. It then opens the xib file in the context of that project, so that Interface Builder will see all the available types and the outlets and action on them. If outlets and actions are added in Xcode 4 using its control-drag system, those are automatically imported back into *.designer.cs files in MonoDevelop.这意味着设计器文件不再从其他文件生成,而是存储信息的实际位置。现在设计器文件与一个类而不是一个xib相关联。
This means that the designer files are no longer generated from some other file, instead they are the actual location where the information is stored. Now the designer files are associated with a class instead of a xib.
这个新模型在支持Xcode 4之上有几个好处:
This new model has several upsides on top of supporting Xcode 4:
- 现在可以将多个xib文件引用到同一个类。
- 该项目包含所有内容资源和其他xib文件,因此可以很容易地从Interface Builder中引用它们
- Interface Builder将看到在C#用户类部件和基类上编写的出口,而不仅仅是设计器类部件。
此外,现在手动编写插座要容易得多。只需将
Outlet
属性应用于属性,例如In addition, it's now much easier to write outlets manually. Simply apply the
Outlet
attribute to a property, for example[Outlet ("someView")] UIView SomeView {get; set; }
不幸的是,新模型意味着MonoDevelop不再与Interface Builder中的插座和操作的创建集成3.2.x.我的建议是你升级到Xcode 4.加载和编辑pre-MD 2.8项目应该可以正常工作。
Unfortunately the new model means that MonoDevelop no longer integrates with the creation of outlets and actions in Interface Builder 3.2.x. My recommendation is that you upgrade to Xcode 4. Loading and editing of pre-MD 2.8 projects should work fine.
请参阅
http://docs.xamarin.com/ios/tutorials/transitioning_from_xcode_3_to_xcode_4这篇关于Monodevelop 2.8,XCode 3.2.6,Interface Builder:Outlets and Actions的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!