Tag: ios8

我可以检测屏幕从iOS 8上的代码是正常的还是紧凑的?

iOS 8引入了故事板和Xib中可用的新屏幕types,我可以在代码中检测这些types吗? 如果是的话,怎么样? 在这里你可以find更多关于它https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html

Swift:创build一个调用另一个class1中的方法的button

我有2个类,第一类被命名为“商店”,在那里我创build一个button,调用一个名为“ExploreViewControllers”的第二个类中的“storeSelected”方法。 该方法应打印“完成”,并带我到另一个视图控制器。 没有segue“完成”被打印,但是当把segue代码的应用程序崩溃。 错误是由于未捕获exception“NSInvalidArgumentException”而终止应用程序,原因:“Receiver()没有标识符”ok“的继续。 // ExploreViewController类 let _sharedMonitor: ExploreViewController = { ExploreViewController() }() class ExploreViewController: UIViewController, UIScrollViewDelegate{ class func sharedMonitor() -> ExploreViewController { return _sharedMonitor } func storeSelected(sender: UIButton) { println("done") // it entered here and "done" is printed self.performSegueWithIdentifier("ok", sender: self) //here is the problem } } //另一个名为“Store”的类 //button is created let monitor = […]

用户拒绝位置服务后再次请求权限?

我跟踪用户的位置,并要求我的负载第一次加载时使用此权限: locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() 如果用户拒绝,但稍后通过在应用程序中启用configuration选项来改变他们的想法,我该如何再问? 例如,我有一个开关来自动检测用户的位置,所以当他们启用它时,我正在尝试这样做: @IBAction func gpsChanged(sender: UISwitch) { // Request permission for auto geolocation if applicable if sender.on { locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() } } 但是这个代码似乎没有做任何事情。 我希望它会再次询问用户是否允许应用程序跟踪用户的位置。 这可能吗?

用于iOS 8扩展的AFNetworking后台会话configuration

我目前正在开发一个iOS 8的应用程序扩展,并有这个最后一块的困难。 在我的应用程序的其余部分中,我使用了一个AFHTTPSessionManager子类,我像这样实例化: + (MYAPIClient *)sharedClient { static MYAPIClient *_sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedClient = [[MYAPIClient alloc] initWithBaseURL:[NSURL URLWithString:kMYBaseURL]]; _sharedClient.requestSerializer = [[MYAPIRequestSerializer alloc] init]; _sharedClient.responseSerializer = [[MYAPIResponseSerializer alloc] init]; }); return _sharedClient; } 当我使用这个普通的API客户端时,只是发布一些文本forms的共享扩展工作得很好,它甚至有时对图像有效(通常会失败),但我知道我需要使用后台会话configuration。 所以我做了一个非常类似的API客户端,像这样的背景configuration设置: + (MYAPIClient *)sharedBackgroundClient { static MYAPIClient *_sharedClient = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSURLSessionConfiguration *sessionConfiguration […]

ios 8如何debugging自定义键盘?

我已经在iOS 8模拟器上用Swift成功地创build了一个自定义键盘。 虽然它运作良好,但我无法debugging它。 它是一个包含的目标,并通过设置 – >常规安装。 在XCode中放置书签不起作用。

如何从iOS键盘扩展中检测到文本字段是通过类似iMessage中的“发送”操作清除的?

在我的iOS键盘应用程序中,我目前有一个文本build议栏,很像默认的iOS 8键盘的build议栏。 我想清除build议栏上的所有文本,只要用户做了一些清除文本字段的内容(例如,当有人在iMessage或Whatsapp上点击“ 发送 ”时)。 由于打“发送” 不是一个按键 ,我想知道是否有办法检测到从文本字段清除键盘时。 我试图检测空文本""或新行"\n" ,但到目前为止这还没有奏效。 编辑:我知道这是可能的通过第三方iOS键盘,如在这里看到的情况下(这是从主板 ) 点击发送之前,请注意build议栏中的文字。 点击“发送”后立即 build议栏被清除。

UIDatePicker问题在iOS 8上popup

有没有其他人与iOS 8的popupUIDatePickers的问题? 突然我们的dateselect器没有正确显示(见截图)。 看起来,select器的一部分没有被显示(尽pipe如此,仍然可以与缺less的部分交互以改变时间)。 我做了一些testing,并且dateselect器在其他视图中完美显示,所以它与popup窗口或在不是全屏的视图中显示select器有关。 有没有人发现这些问题的解决方法或解决方法?

如何获得iOS8 PhotoKit所需的图像大小?

我使用下面的代码来获取图像: [[PHImageManager defaultManager] requestImageForAsset:asset targetSize:CGSizeMake(800, 600) contentMode:PHImageContentModeAspectFill options:options resultHandler:^(UIImage *result, NSDictionary *info) { NSLog(@"size:%@",NSStringFromCGSize(result.size)); }]; 我要求的图像尺寸为800 x 600,但我得到的图像尺寸为45 x 60,质量很差。 我怎样才能得到所需的图像大小使用PhotoKit ?

Xcode迅速失败,退出代码254

我得到这个编译器错误在我的代码,我不明白为什么: <unknown>:0: error: unable to execute command: Segmentation fault: 11 <unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation) Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254 错误显示在以下代码段的某处: var animalViewToSwap: AnimalView = animalViewMatrix.objectAtRow(0, andColumn: 0) as AnimalView var currentRow = 0 var currentColumn = 0 var animalToSwapWith = true var currentLocation […]

如何检测UITableView中的单元格select – Swift

只是想知道如何去执行didSelectRowAtIndexPath或类似的东西到我的应用程序。 我有一个填充表格视图与几个dynamic单元格,基本上我想改变视图一旦选定某个单元格。 我可以在Obj-C中find我的头,但谷歌没有任何东西可以帮助我与Swift! 任何帮助将不胜感激,因为我还在学习