有人使用 MonoTouch 实现了 StackPanel 等效项吗?
当使用 MonoTouch 为 iOS 编写等效 UI 时,我怀念 WPF / Silverlight 的自动布局控件(如 StackPanel 和 Grid)。
我希望有人已经创建了这些,而不是重新发明轮子:-)
我找到了一个 stackpanel 对于 iOS github 项目,但作为 MonoTouch 的新手,我不确定如何将 Obj-C 代码集成到 Mono 项目中。
I miss WPF / Silverlight's auto-layout controls (like StackPanel and Grid) when writing the equivalent UI for iOS using MonoTouch.
I'm hoping that instead of reinventing the wheel, someone has already created these :-)
I've found a stackpanel for iOS github project but being a newbie to MonoTouch, I'm not sure how I would integrate the Obj-C code into the Mono project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
stackpanel 代码似乎基于 UITableView 并为特定情况提供了更简单的 API。
一般来说,您可以将现有的 Objective-C 编译到库中(使用 Xcode)和 为其创建托管绑定。然而,在这种情况下,代码看起来相当小,因此甚至可能更容易转换为 C#(并提供更接近 Silverlight 的 StackPanel 的 API)。
但我强烈建议您查看 MonoTouch.Dialog 它为您提供了更简单的表格 API,包括支持所有者绘制的元素。它也很容易扩展(使用 C#)来创建您自己的元素。请参阅示例项目以了解它们的实际效果。
The stackpanel code seems based on
UITableView
and offers a simpler API for a specific case.In general you can compile existing objective-c into a library (using Xcode) and create managed bindings for it. However in this case the code looks quite small so it might even be easier to translate to C# (and provide an API closer to Silverlight's StackPanel).
But I strongly suggest you to look at MonoTouch.Dialog which offers you a simpler API for tables, including support for owner-drawn elements. It's also very easy to extend (using C#) to create your own elements. See the Sample project to see them in action.