ios8

Split string in 64kb using Swift

ε祈祈猫儿з 提交于 2019-12-25 04:49:13
问题 I would like to split an extremely large string, up to 8mb, in 64kb chunks. At the moment I am using the following code: //1 var regData:String= "string up to 8mb" var count=((countElements(self.regData!))/65536) //2 for var index = 0; index < count; ++index { arr.append(self.regData!.substringWithRange(Range<String.Index>(start: advance(self.regData!.startIndex, 0),end: advance(self.regData!.startIndex, 65536)))) self.regData!.removeRange(Range<String.Index>(start: self.regData!.startIndex,

How do I get the last n characters typed in a UITextView?

时光怂恿深爱的人放手 提交于 2019-12-25 04:48:10
问题 Say I want to check if the last 5 characters typed in a UITextView are "mouse". How would I go about doing this? Specifically in Swift because of how strings indexes are different from Objective-C due to how emojis and the like are stored. I cannot seem to figure this out. And keep in mind the last n characters may not be typed at the end of the text view, the cursor could be in the middle of the text. 回答1: You can use substringFromIndex with textView.text .. Thus the last 5 characters can be

Issue in Widgets in landscape mode

旧时模样 提交于 2019-12-25 04:47:10
问题 I have this irritating issue with widgets that it trims the content of my view in the landscape mode. I have put the content size statically but it doesn't work. Does Apple restrict the widget to have a specific height in landscape? Apple's interface guidelines says it's not recommended but is it doable? Edit: 回答1: There is a height limit for today widgets on iOS. The max height is (screen size) - (notification center UI height). Whatever's left after the notification center draws its UI is

Swift Compile Error Bitcast requires both operands to be pointer or neither

假如想象 提交于 2019-12-25 03:54:42
问题 In Xcode6 beta 1 something similar to this worked, however with Xcode6 beta 4 there were errors. After fixing the errors the errorless code I have is below For Background : The class I'm using here implements ABPeoplePickerNavigationControllerDelegate which allows you the user to select a contact from the address book. I want to get the first email that is added to that person. func peoplePickerNavigationController(peoplePicker: ABPeoplePickerNavigationController!,didSelectPerson person:

UINavigationBar blur iOS 7.1 and above

こ雲淡風輕ζ 提交于 2019-12-25 03:07:27
问题 How to have navigation bar blurred like on the first image here. I did some research, but seems tint color and translucent does not apply for this needs. I am using iOS 7 and iOS 8 The problem that I have table under navigation bar and it change content dynamically, so the blur effect should be changed as well each time I scroll table. 来源: https://stackoverflow.com/questions/29129845/uinavigationbar-blur-ios-7-1-and-above

Autolayout - How to Change width spacing between iPhone 6 and Plus

二次信任 提交于 2019-12-25 02:59:42
问题 Ok, I have been pulling my hair out for a few days now and thought I would ask the community how to deal with width sizes or the gaps between buttons in xcode 6.4 or 7 (tried them both). Ideally I want 2 buttons near the bottom and they need to scale properly based upon iPhone portrait mode. I have added the 1x, 2x, and 3x pngs of the button to the asset system and my auto layout is set for wCompact hRegular which from what I understand allows you to target all iPhone devices in portrait mode

Why won't MKPointAnnotation show up on map?

自闭症网瘾萝莉.ら 提交于 2019-12-25 02:56:06
问题 I have a map setup to show an annotation with this code: var newAnnotation = MKPointAnnotation() if newPostJustPosted { var newPostCoordinate = CLLocationCoordinate2DMake(userPosts.last!.postLatitude, userPosts.last!.postLongitude) newAnnotation.coordinate = newPostCoordinate newAnnotation.title = userPosts.last!.postTitle mainMapView.addAnnotation(newAnnotation) newPostJustPosted = false println("New post was just posted") } This runs no problem, and the annotation shows up. After this, I

Text field stays under the custom keyboard in UIWebView for iOS 8

我只是一个虾纸丫 提交于 2019-12-25 02:34:47
问题 I'm creating a web App for iOS and I have a custom keyboard. When I use the default keyboard, it immediately shows the keyboard and the text field is above the keyboard. I would have the same result if I change the keyboard to my custom keyboard. But the problem is for the time that I gives the focus to the text field when my custom keyboard is enabled. It has some delay to load and when it loads, text field stays under the keyboard. Here is my code for custom keybaord: #import

using an sqlite3 database with an ios8 app using Xcode 6 and swift

半腔热情 提交于 2019-12-25 02:07:51
问题 i'm fairly new to programming. I am working with Xcode 6 and swift to build an iOS 8 app. my app has quite lot of data which i have organised into sqlite3 files using the firefox add on. i have dropped these files into my project folder. their extension is .sql now i need to access that data in my app. i have already linked the sqlite3 library by adding libsqlite3.dylib in the build phases tab. now i want to write the code to access the database. i have found a lot of information online with

DocumentPicker Extension immediately stopped on clicking on the icon

核能气质少年 提交于 2019-12-25 01:46:53
问题 I have created the document picker extension(Both File provide and document picker , with the default implementations) and when i try to open the extension using the DocumentPickerViewController, its immediately closing the DocumentPickerViewController by showing the below issue plugin com.apple.UIKit.fileprovider.default invalidated. I have setup the basic app groups and iCloud entitlement as well, Which are all fine. Even from the documentViewController the default iCloud is working