Tag: xamarin.ios

MVVMCross iOS:当切换到不同的View模型时,如何将自定义转换绑定命令

对于MVVMCross iOS,我怎样才能使用不同的TransitionalStyle,如FlipHorizo​​ntal风格,而不是使用“ShowViewModel”的默认滑动效果? [Register("SearchResults")] public class SearchResultsView : MvxTableViewController { public override void ViewDidLoad() { Title = "List"; base.ViewDidLoad(); var mapButton = new UIButton(new RectangleF(0, 0, 65, 30)); mapButton.SetBackgroundImage(UIImage.FromBundle("images/map_btn.png"), UIControlState.Normal); mapButton.TouchUpInside += MapButtonClicked(); var rightButton = new UIBarButtonItem(mapButton); NavigationItem.RightBarButtonItem = rightButton; var bindings = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>(); //bindings.Bind(mapButton).To(x => x.ShowMapCommand); //how to do with binding command? bindings.Apply(); […]

NavigationBar和导航button中分隔标题

嗨,我有UINavigationController里面的一堆UIViewController 。 通常,标题(或NavigationItem的标题)决定NavigationBar(显示在顶部)显示的标题和所有导航button,例如导航栏本身的后退button。 现在,我打算在NavigationBar的标题中join更多的信息,同时保持这些button标签的简洁和简洁(例如,视图的标题是“<客户名称>概述”,而button应该只显示“概览”)。 我目前正在尝试通过更改ViewWillAppear和ViewWillDisappear上的NavigationItem标题来实现此ViewWillDisappear 。 这个效果很好,但是可以看到文本改变的时刻(可能是由于animation)。 我已经尝试了与ViewDidAppear和ViewDidDisappear不同的组合,但效果是最好的只有Will方法。 下面显示了一个示例代码( Example类被推送到一个UINavigationController)。 有没有更好的方法来实现这个? 也许仅仅是简单地改变button标题,或者直接改变导航标题? 或者我可以阻止标准机制将标题复制到所有其他实例? public class Example : UIViewController { private int depth; public Example ( int depth = 0 ) { this.depth = depth; this.Title = "Title"; } public override void ViewDidLoad () { base.ViewDidLoad(); UIButton btn = new UIButton( new RectangleF( 100, 100, 300, […]

在自定义的UITableViewCell中多次调用UIButton点击事件

我有一个自定义的UITableViewCell里面有一个UIButton 。 点击button时,点击事件会被多次调用。 这是我正在使用的代码。 CustomCell.cs public static CustomCell Create () { return ( CustomCell ) Nib.Instantiate ( null , null ) [0]; } internal void BindData() { //some code btnSave.TouchUpInside+= (object sender, EventArgs e) => { Console.WriteLine("button clicked"); }; } TableSource.cs public override UITableViewCell GetCell (UITableView tableView,NSIndexPath indexPath) { CustomCell cell = tableView.DequeueReusableCell ( CustomCell.Key […]

应用程序在处理导航栏button事件时崩溃

在我的应用程序中,我有一个导航栏button,允许用户弹回到导航堆栈的顶部。 这已经有一段时间了,一直工作正常。 但是,当我用MT 4.0构build它崩溃。 # in constructor UIButton btn = UIButton.FromType(UIButtonType.Custom); btn.Frame = new RectangleF(0,0,29,29); btn.SetBackgroundImage(UIImage.FromFile("images/Home_button.png"),UIControlState.Normal); btn.TouchDown += delegate { this.NavigationController.PopToRootViewController(true); }; UIBarButtonItem bar = new UIBarButtonItem(btn); this.NavigationItem.RightBarButtonItem = bar; 该button绘制正确,但按下button时,应用程序崩溃。 如果我改变委托只是做一个Console.WriteLine()它仍然崩溃。 据我所知,这是工作,直到我安装MT 4.0。 它崩溃时显示的exception是 Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main […]

iOS模拟器无法启动

我想运行Xamarin.Forms的示例示例。 我已经做了示例应用程序。 我已经在项目中添加了所需的软件包,但由于某种原因,我得到了错误 无法启动模拟器:无法加载框架'libswiftCore.dylib'(path:/Applications/Xcode8beta.app/Contents/Frameworks/libswiftCore.dylib):未find。 错误MT1008:无法启动模拟器:无法加载框架'libswiftCore.dylib'(path:/Applications/Xcode8beta.app/Contents/Frameworks/libswiftCore.dylib):找不到。 我在Mac Xamarin studio 6.1.1上使用XCode 8 beta 我已经在Xamarin偏好设置中正确设置了SDK的path,并且说SDK已经在提到的path中可用。 每当我尝试运行应用程序,它编译得很好,但在模拟器预计启动之前,它显示上述消息。 我应该如何解决这个问题?

在MonoDeveloper中获取java.net.MalformedURLException

嘿,我是MonoDeveloper的新手。 我正试图将libgdx代码移植到iOS平台。 我的Libgdx代码可以在桌面和Android手机上运行。 但是,当我在MonoDeveloper iPhone模拟器上运行它给我这个错误: Unhandled Exception: 0 iosgame [ERROR] FATAL UNHANDLED EXCEPTION: java.net.MalformedURLException: unknown protocol: file. 0x000e8932 mono_handle_exception_internal_first_pass + 3058 1 iosgame 0x000ea012 mono_handle_exception_internal + 1602 2 iosgame 0x000eab5f mono_handle_exception + 47 3 iosgame 0x0012dcb2 mono_x86_throw_exception + 306 4 ??? 0x0b73df8f 0x0 + 192143247 at java.net.URL..ctor (java.net.URL,string) <IL 0x00004, 0x00018> at java.net.URL..ctor (string) <IL […]

MonoTouch.Dialog中的每个RootElement都有一个专用的UIViewController?

在MonoTouch.Dialog使用嵌套的RootElements创build多级菜单结构很容易,但是如何才能让特定的UIViewControllerpipe理每个根呢? 我希望每个RootElement拥有它自己的UIViewController的原因是我想要能够轻松地控制背景图像和从屏幕切换到屏幕导航条,这样做是在UIViewController内部进行的。

Monotouch中的子类化和重写UITextField

我正在尝试将UITextField的占位符文本设置为不同的颜色。 我已经了解到,我需要inheritance和重写drawPlaceholderInRect方法。 iPhone的UITextField – 改变占位符的文字颜色 (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blueColor] setFill]; [[self placeholder] drawInRect:rect withFont:[UIFont systemFontOfSize:16]]; } 这是我到目前为止,但我无法弄清楚如何得到它恰到好处。 我对最后一行感到困惑,因为我不知道如何将它映射到MonoTouch / C#对象。 using System; using MonoTouch.UIKit; using MonoTouch.Foundation; using System.Drawing; namespace MyApp { [Register("CustomUITextField")] public class CustomUITextField:UITextField { public CustomUITextField () :base() { } public CustomUITextField (IntPtr handle) :base(handle) { } public override void DrawPlaceholder (RectangleF […]

IB检查在Xam​​arin

有没有人知道如何在Xamarin中使用IBInspectable,或者如果可能的话? 他们唯一在这个话题上find的就是这个没有多大希望的东西。 在API文档中也找不到任何关于它的信息

远程模拟器到Windows选项不存在

Remote Simulator to Windows选项在“工具/选项/ Xamarin / IOS设置”中不存在。 它看起来像这样: 我到目前为止所做的: 我已经从这个资源安装了模拟器。 我已经重新启动了我的PC和MAC Mini。 我已经通过阅读manuel激活了MAC Mini上的远程login。 我检查了电脑是否连接。 我能做些什么来解决这个问题? 谢谢。