从javascript调用objective-c方法

我做任何webView我想从JavaScript调用任何返回任何参数的客观c方法。 我尝试了很多方法,但不允许。 目标c方法在这里: – (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURL *URL = [request URL]; if ([[URL scheme] isEqualToString:@"donordialog"]) { // now we need to figure out the function part NSString *functionString = [URL resourceSpecifier]; if ([functionString hasPrefix:@"bloodTypeChanged"]) { // the blood type has changed, now do something about it. NSString *parameter = [functionString stringByReplacingOccurrencesOfString:@"bloodTypeChanged" […]

核心数据模型文件多核到一个xcode项目是否可行?

我正在研究一个我正在处理核心数据的ipad应用程序。 应用程序pipe理的数据可以分为两类。 第一种数据仅适用于该设备或应用程序。 而另一类数据需要在具有相同应用的各种设备之间同步。 所以在scnerio中,我想到了在我的项目中有两个模型文件和两个corressponding的sqlite文件。 并同步一个sqlite文件,以实现syching。 请build议,如果我的方法是正确和可行的。 如果没有,那么请build议其他解决scheme。 嘿家伙请尝试理解这个问题。 在这里我正在谈论两个不同结构的sqlite文件。 意思是“.xcdatamodel”模型文件 谢谢。

自动滚动到具有特定值的单元格

我有一个这样的表视图中的数字列表。 正如你所看到的数字重复。 我们来看一组重复的数字。 所以有1s组,2s组等等。 我想要做的是当应用程序启动时,我需要自动滚动到指定组的开始位置。 在进一步解释之前,这里是我的代码。 import UIKit class TableViewController: UITableViewController, UITableViewDataSource, UITableViewDelegate { private var scrollToTime = true private var items = [Int]() private var groupNoToScroll = 12 override func viewDidLoad() { super.viewDidLoad() items = [1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 4, 5, 5, 6, 7, 7, 8, 8, 8, […]

在iPhone sdk中从LinkedIn获取用户个人资料数据

使用IOS,我试图将LinkedIn整合到应用程序中。 集成也在起作用,用户login也在工作,但是我无法把所有用户logging的用户configuration文件的数据作为教育,技能和所有数据。 成功login后,我只能得到这四个值。 -first-name -site-standard-profile-request -last-name -headline 任何人都可以请得到所有的价值,而不是这些。 非常感谢。

在MKPolyLineView中绘制CAGradient

我只是与我的MKPolyLineView有问题。 我只是尝试为折线创build颜色渐变,但使用CAGradient则可以实现。 我的子类MKPolylineView和重绘 – (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context UIColor *darker = [UIColor blackColor]; CGFloat baseWidth = self.lineWidth / zoomScale; // draw the dark colour thicker CGContextAddPath(context, self.path); CGContextSetStrokeColorWithColor(context, darker.CGColor); CGContextSetLineWidth(context, baseWidth * 1.5); CGContextSetLineCap(context, self.lineCap); CGContextStrokePath(context); // now draw the stroke color with the regular width CGContextAddPath(context, self.path); CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor); CGContextSetLineWidth(context, baseWidth); CGContextSetLineCap(context, self.lineCap); CGContextStrokePath(context); [super […]

在iPhone中使用移动运营商识别国家代码编程?

有没有办法从移动networking获取国家代码? 我们可以通过代码获取设备中的SIM卡的国家名称吗? 请用一些工作代码来帮助我。 我检查了CoreTelephony框架,但ddnt获得成功。 提前致谢 !!

将时间戳转换成NSDate swift?

在Objective-C中有很多关于这个问题的文章,但是在Swift编程语言中我找不到任何可靠的答案。 我有以下格式的string "/Date(573465600000-0800)/" 我如何将其转换为常规的NSDate对象?

如何从无符号字符创build图像*

我正在尝试从unsigned char *中的原始数据创build一个新的图像。 我从存储的数据中获得每像素的位数。 我试图将原始数据转换成NSData,但结果图像是零, unsigned char * bitmap = myData; NSUInteger myImageDataLength = strlen((const char *)bitmap); NSData * d = [NSData dataWithBytes:bitmap length:myImageDataLength]; imgView.image = [UIImage imageWithData:d]; 然后我尝试使用上下文创build一个图像,如下所示: CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); int width = mWidth; int height = mHeight; size_t bpp = mBpp; size_t bpc = 8; size_t bpr = (width * 4); […]

MKMapView有多个覆盖内存的问题

似乎有一个覆盖和MapKit的“问题”。 与注释不同的是,叠加层不会被重用,因此添加多个叠加层会导致真实设备上的内存问题。 我有这个问题多次。 所以我的问题是,如何重新使用MKOverlay,从而提高MapKit覆盖层的性能?

Cordova + Crosswalk iOS仍在使用UIWebView

我没有发现很多iOS设置的人行横道,看起来应该像下面这样简单: cordova plugin add cordova-plugin-crosswalk-webview cordova build ios 因为我在执行以下操作之前遇到了插件不起作用的问题: cordova plugin add cordova-plugin-crosswalk-webview cordova platform remove ios cordova platform add ios cordova build ios 完成这个之后,当我捕获视图层次结构并检查它仍然使用里面有一个“UIWebBrowserView”的UIWebView(它在滚动视图的内部,并且有几个图像视图)。 另外,navigator.userAgent如下所示: "Mozilla/5.0 (iPad; CPU OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13B143 (5618403776)" = $1 另一个人提到的testing基本上是: if (window.indexedDB) console.log('Using crosswalk'); else console.log('Not using crosswalk/wkwebview'); 而window.indexedDB是未定义的。 所以…我需要做什么,使应用程序使用wkwebview?