Tag: xamarin

来自UIImagePickerController的Xamarin ios – referenceUrl总是为空

我使用UIImagePickerController从图库中select图像。 select图像后,我想更新文本字段上的实际图像文件path。 我可以从referenceUrl获取文件path吗? 在我的情况referenceUrl总是返回null。 protected void Handle_FinishedPickingMedia (object sender, UIImagePickerMediaPickedEventArgs e) { try{ //determine what was selected, video or image bool isImage = false; switch(e.Info [UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); isImage = true; break; } // get common info (shared between images and video) NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; if (referenceURL != […]

Xamarion IOS LexDB保存 – 试图进行JIT编译的exception(包装委托调用)

我在xamarin ios应用程序中使用LexDb.iOS 1.2。 如果我在模拟器evrithings执行完美,但如果我debugging在iOS手机然后: 当我尝试做的时候 db.Save(项目); 抛出这个exception: 尝试JIT编译方法'(包装委托调用):invoke_callvirt_Nullable'1_User(实体)',而运行时只使用 – 。 有关更多信息,请参见http:// xamarinsupport 。) 当我在电话中执行时,我必须做不同的事情吗? 谢谢。

Xamarin UIScrollView GestureRecognizerShouldBegin在滚动视图移动时报告速度为0

我使用Xamarin来开发一个iOS应用程序,我想子类UIScrollView为了处理在滚动视图基于其速度的平移手势。 所以,我重写了GestureRecognizerShouldBegin并检查了平移手势的VelocityInView 。 这适用于第一个手势,但在滚动视图运动(减速)时触发的后续平移手势总是报告(0,0)的速度: public class MyScroll : UIScrollView { public override bool GestureRecognizerShouldBegin(UIGestureRecognizer gestureRecognizer) { UIPanGestureRecognizer panGesture = gestureRecognizer as UIPanGestureRecognizer; if (panGesture != null) { CGPoint velocity = panGesture.VelocityInView(this); Console.WriteLine("Pan gesture velocity: " + velocity); } return true; } } 在滚动处于运动状态的同时平移一次,然后再一次输出: Pan gesture velocity: {X=37.92359, Y=-872.2426} Pan gesture velocity: {X=0, Y=0} 这是一个错误还是这是预期的行为? 编辑:跨Xamarin的论坛上发布: […]

Xamarin iOS客户端证书authentication

我设法成功地使用.Net HttpWebRequest类的客户端证书,但我现在正在尝试更新ModernHttpClient以支持客户端证书,因此它使用更高效的iOS库来处理请求。 我修改了DidReceiveChallenge中的DidReceiveChallenge函数来检查ClientCertificate的挑战,并试图通过https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/AuthenticationChallenges.html上的信息将其转换为Xamarin iOS。 代码编译正确,并逐步通过它导致没有错误打印出来,但最终我仍然得到一个System.Net.WebException与消息“服务器”xxx.example.com“需要客户端证书”抛出。 我的代码在下面… public override void DidReceiveChallenge(NSUrlSession session, NSUrlSessionTask task, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler) { …snip… if (challenge.ProtectionSpace.AuthenticationMethod == NSUrlProtectionSpace.AuthenticationMethodClientCertificate) { Console.WriteLine("Client Cert!"); var password = "xxxxx"; var options = NSDictionary.FromObjectAndKey(NSObject.FromObject(password), SecImportExport.Passphrase); var path = Path.Combine(NSBundle.MainBundle.BundlePath, "Content", "client.p12"); var certData = File.ReadAllBytes(path); NSDictionary[] importResult; X509Certificate cert = new X509Certificate(certData, password); SecStatusCode […]

Monotouch:暂停应用程序单元对话框响应

如何暂停应用程序以防止运行下一个方法单元客户端不select对话框button? 例如,我正在显示位置更新对话框来访问位置服务,我想暂停我的应用程序的对话响应 public CLLocation UpdateUserLocation() { CLLocation currentLocation = null; CLLocationManager LocMgr = new CLLocationManager(); if (CLLocationManager.LocationServicesEnabled) { if (UIDevice.CurrentDevice.CheckSystemVersion (6, 0)) { LocMgr.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) => { currentLocation = e.Locations [e.Locations.Length – 1]; }; } else { LocMgr.UpdatedLocation += (object sender, CLLocationUpdatedEventArgs e) => { currentLocation = e.NewLocation; }; } LocMgr.StartUpdatingLocation […]

如何在xamarin中的两个xib文件之间循环?

我是Xamarin新手,我正在通过应用程序工作。 我也使用mvvmCross。 如何在button点击两个视图之间继续? 通常情况下,我使用故事板,这就像控制简单+点击并拖动挂钩。 我的第二个想法是做这样的事情: PerformSegue(identifier, sender); 但是,当我打开xib编辑界面时,我无法设置标识符。 所以我有两个xib文件,HomeView.xib和SecondView.xib。 以及两个C sharp文件HomeView.cs和SecondView.cs。 HomeView有一个button,我有控制+ IBAction到C的清晰,并有一个方法buttonPressed()我想继续进入我的secondView。 partial void ButtonPressed (Foundation.NSObject sender){ //Insert Code to segue to SecondView. } 谢谢 :) 编辑:我发现这段代码: NSBundle.MainBundle.LoadNib("SecondView", this, null); 哪个起作用,然而一个赛格将仍然是可取的,因为它看起来更好

如何隐藏数字键盘,我使用Xamarin iOS(C#)

我发现在Objective-C上的问题的答案,但我不在Xamarin iOSsearch。 所以我有用户写电话号码的字段,这个字段编辑时出现键盘,数字键盘types。 但是这个键盘不会隐藏,也没有隐藏button。 在android应用程序中为这个问题我使用代码: one.Click += delegate { InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(ulitsa.WindowToken, 0); }; 在我的iOS应用程序这个代码不起作用。 我在iOS的代码: tel.ShouldReturn = delegate { tel.ResignFirstResponder (); //tel.ReturnKeyType = UIReturnKeyType.Done; return true; }; 此代码适用于默认键盘types。 在键盘types的数字键盘我有截图的结果: 我如何解决我的问题?

Xamarin在iOS中使用自定义UITableViewCell时抛出NullReferenceException

我有一个非常类似的问题,在Xamarin自定义UITableViewCell抛出系统NullReferenceException讨论的问题。 尽pipe如此,在回答问题之后,我的问题还没有解决。 我有一个自定义的UITableView BoardListCell 。 在我的故事板,我有一个UITableView 。 它可以在我的ViewController通过socketstableView 。 在我的视图控制器,我得到的数据。 然后我做tableView.Source = new BoardsTableViewSource(sourceData); 我的BoardsTableViewSource : using System; using System.Collections.Generic; using Foundation; using UIKit; public class BoardsTableViewSource : UITableViewSource { private List<List<Object>> data; Boolean normalBoards; public BoardsTableViewSource (List<List<Object>> data, bool normalBoards) { this.data = data; this.normalBoards = normalBoards; } public List<List<Object>> getData() { return data; […]

拉下更多的细胞

我在互联网search了一个代码片段或者配方,它检测用户是否滚动到UItableview点触摸的UItableview上的最后一个单元格。 我不使用TableSource.Cs来加载我的对象。

用于检测TableView底部的伪代码

我试图检测用户何时到达Xamarin.iOS表的底部。 我已经创build了这个伪代码,以便检测底部,但是一旦应用程序运行,打印它已经在表的底部,实际上它不是。 float height = tableView.Frame.Size.Height; float contentYoffset = tableView.ContentOffset.Y; float distanceFromBottom = tableView.ContentSize.Height – contentYoffset; if (distanceFromBottom < height) { Console.WriteLine ("Bottom of Table"); } 任何build议,以改善这个代码或任何更好的方法来检测底部? 这是我的TableView.cs类: public class TableView : UITableView, ITableCellProvider<Datum> { public TableView () { } public TableView (IntPtr handle) : base(handle) { } public UITableViewCell GetCell (Datum item) { var […]