Custom keyboard with native prediction in iOS 8 - ios

The goal: to create a custom keyboard for Russian lang with QuickType (Predictive) which should look like native (I can't post image because of small reputation but I guess it's clear to understand) with some changes: own algorithm to show words; user can chose from more than 3 options
I've found out that it can not be done by standart features (like "set some property like quickType to YES"), but may be exists some another way to do it? e.g. create custom view or smth like that, so the question is:
Can I do so by custom view (with height greater than "215 +/- px") or is there some other way? And will Apple take it then?
UPD It's important that custom looks exactly as native.

You can add your custom word completion view as a sub view of the keyboard (the same way you add the buttons for your keys). Of course you will need to increase the height of the keyboard in order to provide the additional height for your completion view.
Apple Documentation
You can adjust the height of your custom keyboard’s primary view using Auto Layout. By default, a custom keyboard is sized to match the system keyboard, according to screen size and device orientation. A custom keyboard’s width is always set by the system to equal the current screen width. To adjust a custom keyboard’s height, change its primary view's height constraint.
You can also find a code sample on that page. I see no reason Apple will reject based on what you're describing.

Changing the height is possible. Check out this question iOS 8 Custom Keyboard: Changing the Height
You can provide a custom view to show prediction. 'Touchpal' in the App Store may be helpful for you. The 'Touchpal' English keyboard has some QuickType features just like system keyboard.

Your custom keyboard look and feel and your predictive mechanics (QuickType like) are all your responsibilities. There is no way to just copy or enable something. You should just program another absolutely the same keyboard from scratch and another QuickType-like algorithm. iOS8 just provides you with empty view that you can change height for.

Take a look at the UILexicon object and especially at the UITextChecker:
UITextChecker *checker = [[UITextChecker alloc] init];
NSRange checkRange = NSMakeRange(0, text.length);
NSRange misspelledRange = [checker rangeOfMisspelledWordInString:text
range:checkRange
startingAt:checkRange.location
wrap:NO
language:#"en_US"];
NSArray *arrayCorrected = [checker guessesForWordRange:misspelledRange
inString:text
language:#"en_US"];
return [arrayCorrected objectAtIndex:0];
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextChecker_Class/index.html

Related

Disable Automatic adjusting font for UILabel,UIText,etc. in iOS/Swift?

Go to "Settings"-> "General"-> "Accessibility"-> "Larger Text" to change the font size.
Open my app, now all the UILabels and UIButtons do change accordingly. I want to disable it and want to keep as it is regardless of the large font or small font on the setting. I have made everything programmatically. How can I disable this?
myLabel.adjustsFontForContentSizeCategory = false
Although this depends on the font that you're using. See more info here: https://developer.apple.com/documentation/uikit/uicontentsizecategoryadjusting/1771731-adjustsfontforcontentsizecategor?language=objc.
Specifically, this part:
For this property to take effect, the element’s font must be vended
one of the following ways:
It must be vended using the preferredFontForTextStyle: or
preferredFontForTextStyle:compatibleWithTraitCollection: method with a
valid text style.
It must be vended using one of the scaling methods from UIFontMetrics.

Is there something like UITextView for Apple Watch?

I need to display quite a bit of text and the only option I see is WKLabel. There are only about three screens worth of text so it isn't too big. How can this be accomplished?
If you use a WKInterfaceLabel set the lines property to '0' and set the height to Size To Fit Content in your storyboard.
You need to use WKLabel.
If you want your user to write something, use presentTextInputControllerWithSuggestions.
Text and labels from Apple Documentation
WatchKit provides a standard modal interface for retrieving text input from the user. When presented, the interface allows the user to enter text via dictation or to select from a standard set of phrases or emoji.

Change NSAttribtuedString Formatting Starting at Index

I have a UITextView with attributes enabled, and I want to change the formatting (font/alignment/color/etc) within the NSAttributedString starting at a point. In other words, there is no specific part of the underlying NSAttributedString I want to change per se, I just want to make the next thing added into the UITextView have different formatting from what is in there so far.
For example, you might imagine a UITextVIew with a string inside it, and then the user enters a new line and taps a button to increase the font size. The user does not want to increase the font size of everything, just starting at that point.
Can this be done? Thanks.
If you need precise control over the dynamic style behavior of your UITextView (and if you are >= iOS 7), you should consider using Text Kit, and in particular subclassing NSTextStorage. There is a introduction video to Text Kit from WWDC 2013, and a great tutorial by Ray Wenderlich.

iOS custom keyboard on iPad

I'm building an iPad app witch will use a numeric keyboard. The numeric keyboard for the iPad is really huge, all i need is something smaller, something like the decimal keyboard for the iphone.
If i use the default one, half the screen gets covered with keys i dont need. I know i can move the textfields out of the way but it is such a waste of screen space.
So i tried building a custom UIView with no button for start and setting the textfield.inputview to my custom UIView.
The only thing i got is that my custom view is displayed like/in place of/the stock keyboard and the only thing i can change is the height of the custom view.
How could i build a sort of custom keyboard that apple will accept and works with the textfields.
Thank you.
I found what i was looking for. The answer is UIPopover. I managed to build a custom keypad inside a uipopover.
Here's a good tutorial for the uipopover:
http://www.appcoda.com/uiactionsheet-uipopovercontroller-tutorial/
And here's some more info on what you have to do to make it work:
http://iphone-bitcode.blogspot.fr/2011/12/custom-number-pad-on-ipad.html

Is it possible to customize a text field , in iOS?

i am in need to use a text field in my application but the ones provided by XCode are only 1 line long and you can only change the width but not the hight.
I was wondering if its possible to make it look more lines long?
Is it only possible with customization and if yes any good tutorials?
Thank you!
First off, you can actually change the height of a UITextField. Just change the border style in the Attributes Inspector to anything except the default "rounded corners". You can then resize it right in Interface Builder. If you really wanted to, you could even change it back in your viewDidLoad method like this:
self.myTextField.borderStyle = UITextBorderStyleRoundedRect;
However, to have multiple lines, you have to use a UITextView. It's by default multi-line, but see the Apple documentation for more information.
You can use a UITextView. The document about it here. If you need something else, please post an image of what you want to achieve.

Resources