Tag: xamarin.ios

如何pipe理QLPreviewController中的内存

我们正在使用QLPreviewController来加载一组PDF文件。 collections的大小可以从16,95,甚至1600+ PDF。 由于包含多个项目的PreviewController的数据源,我们现在可以在预览模式中向左或向右滑动并加载列表中的下一个PDF。 此function引入了一个问题,即在集合中各个位置的控制器中出现灰色屏幕。 可能发生在第3项,第50项或第161项; 这个错误非常不一致,难以重现。 当模式中出现灰色屏幕时,向左或向右滑动的function将不再可用。 解除模式并从表格源重新selectPDF后,它加载没有问题。 这个经验加强了我们的理论,即由于内存pipe理问题出现这个灰屏。 无论数据源的大小如何,在QLPreviewController中pipe理内存的正确方法是什么? 是否有代码示例演示如何在数据源中使用QLPreviewController和多个项目?

设置CTStringAttributes字体后无法访问string大小

我正在尝试使用string和特定字体呈现一个CATextLayer。 如果使用CATextLayer设置字体,字体不会正确呈现。 如果我在CTStringAttributes中设置字体,那么我得到以下错误: Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[__NSCFType screenFontWithRenderingMode:]: unrecognized selector sent to instance 0x13dba570 这是我想要使用的代码: CTStringAttributes ctsa = new CTStringAttributes(); //This method returns what out kerning should be loosely based on the //tracking number our UI designer uses in Adobe Illustrator var trackingSize = MyFonts.IllustratorTracking(200f * 0.8f, MyFonts.CardHeader.PointSize); ctsa.KerningAdjustment […]

在MonoTouch的Core Bluetooth中解决“CBConcreteCentralManager未开机”的问题

目前正试图让Bluteooth样本工作。 我使用此示例作为参考 – http://developer.apple.com/library/mac/#samplecode/HeartRateMonitor/Listings/HeartRateMonitor_HeartRateMonitorAppDelegate_m.html#//apple_ref/doc/uid/DTS40011322-HeartRateMonitor_HeartRateMonitorAppDelegate_m-DontLinkElementID_4 我的设备上启用了蓝牙function。 我已经尝试使用如下代码: _manager = new CBCentralManager (); _manager.DiscoveredPeripheral += HandleDiscoveredPeripheral; _manager.ConnectedPeripheral += HandleConnectedPeripheral; _manager.DisconnectedPeripheral += HandleDisconnectedPeripheral; 我已经尝试编写自己的inheritance自CBCentralManagerDelegate的委托 但是当我打电话给StartScan void StartScan () { var spp = Guid.Parse("00001101-0000-1000-8000-00805f9b34fb"); _manager.ScanForPeripherals(new [] { spp }, null); } 然后我看到一个错误: bluetooth1[1210:907] CoreBluetooth[WARNING] <CBConcreteCentralManager: 0x9beea0> is not powered on 寻找这个错误,我发现只是几个点击: 什么原因导致CBCentralManagerStateUnknown在iOS? http://www.zitao.org/wiki/development-log/le-zeng/2012-Nov-week1-devnote.html 但是这些都不是特别有用… 我试图拖延开始,直到状态改变: void HandleUpdatedState (object sender, […]

如何在DialogViewController上将背景设置为透明

当我将MonoTouch.Dialog背景颜色设置为uiclear(透明)时,它会抛出exception,为什么? 以及如何将其设置为透明。 未处理的exception:System.NullReferenceException:未将对象引用设置为MyDialogViewController.LoadView()中MyDialogViewController.cs中的[0x00016]对象引用:ParentViewController.View.BackgroundColor = UIColor.Clear public class MyDialogViewController: DialogViewController { public MyDialogViewController (RootElement root) : base (root) { } public override void LoadView() { base.LoadView (); this.TableView.BackgroundColor = UIColor.Clear; ParentViewController.View.BackgroundColor = UIColor.Clear; } } public void xxxxx(){ var menu = new RootElement(""){ new Section ("Demo"){ new EntryElement("Name", "",""), }, }; var menuDVC = new MyDialogViewController […]

Game Center排行榜(Sandbox)中只显示一名玩家

在Game Center的沙箱环境中,我testing了两个不同的用户。 不幸的是,我只能在排行榜上看到一名球员。 只有login的玩家。 我认为它应该更新一段时间后,但现在(24小时后),我仍然只看到领先董事会中的一个用户。 这在沙箱环境中是否正确?

iOS的iPhone SQLite和Monotouch的问题

我已经用Monodevelop 2.8成功开发了一个小型的iPhone + Monotouch(最新版本)应用程序,它使用SQLite的“编译”版本来启用FTS4。 要将SQLite编译为静态库(libSQLite.a),我将此主题作为教程使用 : 如何在SQLite中使用FTS与Monotouch for iOS 此外,我已经按照这个教程来创build一个模拟器+设备兼容的静态库: 使用Xcode和SDK 4 +构build胖静态库(设备+模拟器) 事情在模拟器上工作很好。 🙂 坏消息来自设备,iOS 4的iPhone 4.当我在设备上部署和运行应用程序时,它突然崩溃。 在monodouch项目中使用libSQLite.a静态库我按照这个教程http://docs.xamarin.com/ios/advanced_topics/linking_native_libraries 在使用这个附加命令编译的设备上运行应用程序时,似乎出现了问题: -gcc_flags“-L $ {ProjectDir} -lSQLite3 -force_load $ {ProjectDir} /libSQLite3.a”如果我编译和部署应用程序时没有附加命令(使用静态链接库)程序启动时不会崩溃。 任何build议? 任何人已经在iOS的Monotouch应用程序上使用SQLite与FTS4?

如何在Xamarin iOS中绘制文本?

我想在自定义View的Draw方法的给定点(x,y)处绘制文本。 我从Xamarin站点跟踪了这个示例 。 这是我创build的视图: public class MyView : UIView { public override void Draw(CGRect rect) { using (var context = UIGraphics.GetCurrentContext()) { DrawText(context, "hello", 20, new CGPoint(0, 0)); DrawText(context, "how are you", 20, new CGPoint(0, 40)); } } private void DrawText(CGContext context, string text, int textHeight, CGPoint point) { var x = point.X; var y […]

IOS引脚注释最初显示,然后使用自定义图像

我有一个IOS应用程序,显示地图,并让用户从列表中select一个路线。 select后,应用程序在地图上绘制这条路线。 我正在使用自定义图像作为我的路线点。 我第一次运行我的应用程序,并select一个路线,默认的图钉加载在地图上。 如果我刷新我的地图或select另一条路线,我的自定义图像显示完美。 这只是第一次,这是发生。 我正在使用MKAnnotation,而不是MKPinAnnotationView,我确定没有指定PinView的代码。 任何帮助指出我在正确的方向来弄清楚这里发生了什么,将不胜感激。 谢谢! 这些是我的自定义注释类 公共类RouteAnnotation:MKOverlay { private CLLocationCoordinate2D _coordinate; private string _title; public override CLLocationCoordinate2D Coordinate { get { return _coordinate; } set { _coordinate = value; } } public override string Title { get { return _title; } } public RouteAnnotation (CLLocationCoordinate2D coord, string t) : base() { […]

UAMollectionView与Xamarin.iOS(MonoTouch)网格布局?

我想知道是否有一个UICollectionView实现周围显示在网格中的视图(图像),如下所示。 我开始用UITableView来构build它,但是如果一个项目与它的前任/后继者不在同一行中,那么它就变得非常复杂了。

UITableViewDelegate问题 – RowSelected给出了错误的NSIndexPath

我有我已经分类的UITableViewSource。 我重写GetCell和使用我自己的subclassed单元格,如下所示: public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { MarketItem item=_tableItems[indexPath.Section].Items[indexPath.Row]; MarketCell cell=tableView.DequeueReusableCell(_cellIdentifier) as MarketCell; if (cell==null) { cell=new MarketCell(UITableViewCellStyle.Subtitle,_cellIdentifier,item); } // decorate the cell // … return cell; } 这工作,但是当我得到我的UITableViewDelegate事件,索引path得到我错误的单元格(像AccessoryButtonTapped,WillSelectRow等事件)。 部分和行号看起来是正确的,但是当我做一个 tableView.CellAt(indexPath) 我得到错误的单元格。 (行和段号再次看起来是正确的。) 注意事项: 表不断更新 – 项目到达不同的线程然后InvokeOnMainThread'd 虽然表格不断更新,但只添加了行和部分 – 没有重新sorting或删除 如果我在获取“WillSelectRow”的时候暂停更新,这并没有帮助 最有趣的是(但不是一个可交付的解决scheme),如果我每次做一个新的单元而不是做DequeueReusableCell,它能正常工作。 我不禁认为这是我自己制造的一个愚蠢的错误,但无法find它。 任何帮助将非常感激地收到!