Keep Entire Text From Changing - ios

I have been trying to make a font type app for iOS in Xcode. It alters the normal text into emoji and unicode type letters and there are several different font variations to choose from. Right now, every time a new font is chosen, it changes the whole text field to that one selected font. But I'm trying to make it so that it doesn't effect the whole text field when a new font is selected, only the words that will be typed from that point on. I would appreciate if someone could help me with the code that would allow this. I would think its very easy but just not sure what to do.
An example app that does what my app does: https://itunes.apple.com/us/app/textizer-fonts-fun-looking/id563544682?mt=8
An example app that does what i want my app to do: https://itunes.apple.com/us/app/better-fonts-free-cool-new/id735011588?mt=8
Thanks in advance!
***Edit: My question is different because others are referring to actual fonts in the code and program. My situation is totally different. This is a special kind of app and the "font" is actually unicode symbols which is all the same language to a computer. So im actually just trying to make xcode and the app change without clearing the last symbol effect on the keyboard. It just like normal typing, and would actually be normal if it didn't change after a new one is selected. Not sure why the whole text box changes to the font that is selected, but i would think that its really easy to just add a line of code that doesn't make it change all the letters. If you just checked my links you would easily be able to see. Thanks again and sorry for the confusion. All help and code is appreciated.

Related

How to store and display styled text in iOS with Swift in a UITextView

I'm a beginner to iOS development and I'm learning how to build something along the lines of a note taking app using Swift, and I want to allow the user to bold, underline, and italicize text. Kind of like how it's done in Apple's Notes app. I'm using a UITextView right now, but that only allows for basic text input.
I want to know how these options are displayed to the user and also how to store this text information. Simply storing the user input as a string doesn't work because it has no way to retain the bold, underlined, and italicized portions (or maybe I'm missing something). Does apple have API for something like this? I have looked into NSAttributedString, but I'm not really sure if that works for this case.
Any help is greatly appreciated, thanks in advance!

Customising the Decimal pad in my app

Swift...
So I've got an existing app and I'm working on its appearance. The current task is customising the decimal pad that pops up when the user hits a textField.
I've looked around on how to make it but it always seems that you have to go into the iPhone/ipad settings and add the custom keyboard.
eg. This StackOverFlow Question
and they all seem to point to this same tutorial..
iOS 8: Creating a Custom Keyboard
My problem is that I don't want the user to have to go into settings.
So the question is....IS THIS POSSIBLE?
The following pic is what I want to use. I have made this in an XIB file through adding a target keyboard which makes the new folder with KeyboardViewController.swift , info.plist and NumPad.xib. Though i think I'm on the wrong track, can someone point me the right way please.
Also anyone know the exact dimensions this view should be.. assuming what I'm asking is in fact possible. Let me know if I'm not being clear enough!
NumPad.xib(pic)
Many many thanks,
Steve
SOLUTION: Thanks to Andrea for correcting my search keywords. It led me to this Stack Question which hopefully sends some others to the correct end of the internet that have mistakes custom keyboard with custom input views!
Sure it is possible without going into settings, but they are called custom input views.
You should look into inputViews here what Apple says about them Custom views for data input.
Basically when the user press a text field instead of loading the usual keyboard it loads an inputView that you specify, pay attention that custom keyboard term is misleading. If you google for tutorial you'll find most probably link like the ones that you found.
For a practical example check this tutorial or this, is a little bit old, but the principle are still the same

How to make Facebook mention like highlighting word in UITextView?

HERE IS SAMPLE IMAGE -->
I'm trying to make text input feature very similar to Facebook's one. The mention that start with # will generate list of my friends name then selecting one will act as something like an object. So deleting the highlighted word will remove whole word in UITextView.
I wonder if that is part of UITextView. Does anyone know how to implement?
Thank you in advance.
I know this is a pretty old question but I've actually made libraries that assist with mentions, when to show the list, does the highlighting etc. It uses attributes on an attributed string to set background.
https://github.com/szweier/SZMentions
https://github.com/szweier/SZMentionsSwift
You'll want to have a look at NSAttributedString. While this class exists in iOS 3.2 or greater, you cannot display it in a UITextView unless you are on iOS 6 or later.

How do I go about building a native iOS rich text editor?

We want a native rich text editor because we are trying to stay away from using Javascript and webviews for this solution.
We've tried many things so far, and we're left with quite a few obstacles that we just can't get around. Let me break it down into questions that I hope you can answer.
I have a UIButton, that says "B" on it, and I want to put it into the 'selected' state when a user sets 'Bold' from using the TextView's long-press gesture on a selection. How do I register for this state change? I tried adding an observer on the textView.attributedText, but it doesn't seem they are changing that dictionary, but instead are updating it. NSDictionary has no way, as far as I know, to add observers on the dictionary's keys. So I'm stuck with noticing this change.
Regarding number 1, I also tried setting the textView's inputDelegate and it seems that the method - (void)textDidChange:(id )textInput never gets called. :( Docs says is should. What did I do wrong?
How do I update the attributedText weight when I hit my bold italic or underline button.
How do I convert my attributed text into HTML?
I saw a few neat libraries for number 4, but I'm still curious what you'd come up with. (Broadens my options). But, I can't really work on number 4 until I figure out how to do the previous 3.
This editor will also need hyperlinks, bulleted lists, and numbered lists, more things I imagine I'll struggle through, but if you could answer the 4 questions above, that will keep me held over for a while. :)
Thanks!
Here is a link to an iOS rich text editor I've been working on.
https://github.com/aryaxt/iOS-Rich-Text-Editor
There is still a lot of work that has to be done, but the basic features are there.
The Apple sample application called 'TextEdit' does much of what you've described and, if not that, would be a very good starting point. Find the sample code with a search in the Organizer.
There is a commercial editor based on the DTCoreText library. I've used that library but not the rich text editor. Look at the Cocoanetics web site. It's not cheap but will save you a ton of work.

How to make long text accessible

I'm trying to make my app more accessible but I have a problem. Part of my app consists of pieces of advice, each composed of an UIScrollView with long text. (The text is a UIImage I prepared with Photoshop ).
I would like to make it accessible so that the users could listen to all the advice and pause it whenever they want. I thought of using UIAccessibilityLabel but the text is too long.
Thanks in advance for your help.
Let me preface this by saying I am not an iOS developer but am a long time blind iOS user.
There is no way to easily pause the reading of text and resume at the exact same spot that I know of. According to the documentation, I've found accessibilityLabel is meant to provide accessibility information that can be conveyed in under a sentence. An option I can think of would be to test whether VoiceOver is enabled using UIAccessibilityIsVoiceOverRunning. If this is true, you could put your text into a text view, and display that instead of your UIImage.
A textView will allow a VoiceOver user to read the text by character, word, or line, which is the best option available. If VoiceOver isn’t running, your test will return false, the UIImage will be displayed as normal, and the user won’t see anything different.

Resources