ios9

IOS 9 UITableView整理

旧城冷巷雨未停 提交于 2019-12-02 05:20:15
首先,UITableView有两种风格:UITableViewStylePlain和UITableViewStyleGrouped。 然后,UITableViewCellStyle的样式 typedef NS_ENUM(NSInteger, UITableViewCellStyle) { UITableViewCellStyleDefault, // 左侧显示textLabel(不显示detailTextLabel),imageView可选(显示在最左边) UITableViewCellStyleValue1, // 左侧显示textLabel、右侧显示detailTextLabel(默认蓝色),imageView可选(显示在最左边) UITableViewCellStyleValue2, // 左侧依次显示textLabel(默认蓝色)和detailTextLabel,imageView可选(显示在最左边) UITableViewCellStyleSubtitle // 左上方显示textLabel,左下方显示detailTextLabel(默认灰色),imageView可选(显示在最左边)}; 当然也可以自定义TableViewCell。 要使用UITableView必须要实现两个协议UITableViewDataSource和UITableViewDelegate

IOS9 Push Battery Saver Mode - didReceiveRemoteNotification not called

馋奶兔 提交于 2019-12-02 05:18:02
On IOS9 if an iPhone is in battery save mode, the callback application:didReceiveRemoteNotification:fetchCompletionHandler: is not called. Instead I get the following warning in the console High Priority Push: com.your-company.app - Battery Saver Mode Enabled When using PushKit it does seem to work. Does anybody else experience this behaviour? Any other workarounds? I believe, unfortunately, that this is the intended behavior. The documentation about push notifications constantly hedges their reliability. E.g.: https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual

Implement app thinning in iphone application

廉价感情. 提交于 2019-12-02 05:06:18
问题 My iOS application's size is quite bigger on app store. How can I lower achieve the app thinning so that application size get lower. Note :- I am already using Images.xcassets to put x/2x/3x images separately. I also read this apple documentation and take care of optimisation level build settings. I am also using an 8-bit PNG instead of a 32-bit PNG. 回答1: App slicing is currently not working until further notice. The only way to reduce your app size is currently to reduce the amount of assets

Declaration is only valid at file scope (extension)

这一生的挚爱 提交于 2019-12-02 03:44:09
i try to make my app just in portrait mode iam using navigationcontroller i get this error iam usring Xcode7 and Swift 2 And Target System IOS 9.3 Declaration is only valid at file scope extension UINavigationController { public override func supportedInterfaceOrientations() -> Int { return visibleViewController.supportedInterfaceOrientations() } public override func shouldAutorotate() -> Bool { return visibleViewController.shouldAutorotate() } } extension UITabBarController { public override func supportedInterfaceOrientations() -> Int { if let selected = selectedViewController { return

Use of unresolved identifier countElements [duplicate]

拈花ヽ惹草 提交于 2019-12-02 03:20:37
问题 This question already has answers here : String length in Swift 1.2 and Swift 2.0 [duplicate] (5 answers) Closed 3 years ago . let newLength = countElements(textField.text) + countElements(string) - range.length; When i'm running my app, it suddenly shows the error of unresolved identifier. 回答1: It appears you are attempting to use Swift 1.0 code in a later version of Swift. countElements was removed in iOS 8.3 (with Swift 1.2) -- you need to be logged in to see the release notes in Swift 2.0

Use of unresolved identifier countElements [duplicate]

陌路散爱 提交于 2019-12-02 02:09:08
This question already has an answer here: String length in Swift 1.2 and Swift 2.0 [duplicate] 5 answers let newLength = countElements(textField.text) + countElements(string) - range.length; When i'm running my app, it suddenly shows the error of unresolved identifier. It appears you are attempting to use Swift 1.0 code in a later version of Swift. countElements was removed in iOS 8.3 (with Swift 1.2) -- you need to be logged in to see the release notes in Swift 2.0, it is now str.characters.count 来源: https://stackoverflow.com/questions/31337317/use-of-unresolved-identifier-countelements

UITabBar and back button disappears in iOS 9

折月煮酒 提交于 2019-12-02 01:13:59
In iOS 9, when I segue from a table to a navigation controller, the nav bar and the tab bar disappear. As a result, my users will be hosed. How to fix it? My StoryBoard structure is basically this: ->Tab Bar Controller->Nav Controller->Table View->Nav Controller->Table View->.... When I select a row in the first table view, the segue occurs, but the tab bar and back buttons disappear. ----> Notice the missing parts in the right picture. DTS request has been filed, bug was reported months ago etc. Yes, as I stated, you can't nest a navigationController within a navigationController, or you will

Swift iOS 9 NSURLErrorDomain Error -1004

╄→гoц情女王★ 提交于 2019-12-02 00:53:03
I'm using Swift 2 and Alamofire with both iOS 9 and iOS 8. In iOS 8 all my requests to my API work fine. In iOS 9 they immediately fail with a -1004 NSURLErrorDomain with the message "Could not connect to the server.". I read about Apple's change with App Transport Security and already added the entry to my Plist to disable it and allow insecure connections. I'm at a loss as to the reason for this error...any help would be great! After messing around with a ton of different keys and values to make it work, I finally have come up with this to make it function in iOS9.1: <key

iOS9系列专题一——3D Touch

拜拜、爱过 提交于 2019-12-02 00:44:40
新的触摸体验——iOS9的3D Touch 一、引言 在iphone6s问世之后,很多果粉都争先要体验3D Touch给用户带来的额外维度上的交互,这个设计之所以叫做3D Touch,其原理上是增加了一个压力的感触,通过区分轻按和重按来进行不同的用户交互。 二、在模拟器上学习和测试3D Touch 3D Touch是一个很新颖的设计,可是苹果文档有言: With Xcode 7.0 you must develop on a device that supports 3D Touch. Simulator in Xcode 7.0 does not support 3D Touch. 看到这句话心是不是凉了一半,是的,xcode7是支持3D Touch开发的,可是模拟器并不支持这个手势,我们只能在真机上进行学习与测试,但是在IT的世界,从来都不缺拯救世界的人物,github上有人为我们提供了这样的一个插件,可以让我们在模拟器上进行3D Touch的效果测试: git地址: https://github.com/DeskConnect/SBShortcutMenuSimulator 。 附.SBShortcutMenuSimulator的安装和使用 其实安装和使用并不需要怎么介绍,git主页里介绍的很清楚,这里在记录一遍,其中只有一点需要注意,如果你像我一样

iOS9系列专题二——全新的搜索功能api

半城伤御伤魂 提交于 2019-12-02 00:44:11
更加智能的搜索方案——iOS9搜索功能新api 一、引言 iOS9中为我们提供了许多新的api,搜索功能的加强无疑是其中比较显眼的一个。首先,我们先设想一下:如果在你的app中定义一种标识符,在siri和搜索中,可以用过这个标识符搜索到你的app,是不是很棒?不,这还差得远,你可以定义任意的数据,使其在搜索和siri中可以快速检索到,这样的搜索功能是不是非常酷?不,还有更cool的,你甚至可以在你的网站中添加一些标志,使apple的爬虫可以检索到,那样,即使用户没有安装你的app,也可以在搜索中获取到相应的信息,这太强大了,对吧。 二、3种全新的搜索模式 ‍1、NSUserActivity‍ 我们可以在项目中使用相应的函数来添加一些用户的活跃元素,使我们可以在搜索中通过搜索这样的活跃元素展现我们的app。例如: //创建一个对象,这里的type用于区分搜索的类型 NSUserActivity *userActivity = [[NSUserActivity alloc] initWithActivityType: @"myapp"]; //显示的标题 userActivity.title = @"我的app"; // 搜索的关键字 userActivity.keywords = [NSSet setWithArray: @[@"sea",@"rch"]]; // 支持Search