I noticed a behaviour of UITextView in iOS, where auto detected links and phone numbers do not appear in UITextView's tint color, but black and underlined instead.
It appears to be related to other surrounding links. My guess is, that iOS tries to autodetect whole contact information.
However I don't want this behaviour in my app. What is this behaviour, and more importantly: How do I override it? I want links and phone numbers always to use the selected tint color. Setting the linkTextAttributes does not help either.
All of the following examples were made with a new, empty project containing a single UITextView; Data Detectors set to Phone Number, Link and Address.
Example 1:
Example 2:
Example 3:
EDIT: In case I did not word my question clearly enough: I want data detection to happen, but in a consistent way. Every phone number and link should appear blue and not black and underlined.
My actual app pretty much looks like example 1, although with fewer phone numbers. The blue and black mix just doesn't look right.
I've also added a screenshot of a sample project. There's no code involved. Open Xcode, create an empty project, drop an UITextView in your storyboard and enter my example text. Enable data detectors and run the app:
Related
I am trying to implement a font size changer functionality similar to the one provided by the iBooks app in iPhone.
I know how to set the font using Dynamic Type when Text Size changes at the phone level, but the requirement here is to allow the user to change the font size within the app, and update the content as per the new font size.
(I need to change the brightness and the font size only.)
I looked over the net and found this link
This link shows a manual way of doing it. I was wondering if this a common requirement among apps and is there a standard way/cocoa pod to do this?
Thanks in advance.
Been a Java developer for about 8 years, and was used to using the term "library" which I believe didn't make much sense in the iOS world.
I was looking for something that lets me change the font size and the screen brightness in one shot since I thought it would be a common requirement in most of the reading apps. Something like this :
Since I didn't find anything, and like #WTEDST mentioned saying it requires few lines of code, I went ahead and
Added a view(B) on top of my main view(A)
Showed this view(B) only on clicking of the ᴀA button
This view(B) contained the slider component and 2 buttons at the bottom for increasing and decreasing the font size.
I added a method to change screen brightness on moving the slider and another method on each of the increase/decrease font buttons.
Used a UIStackView to arrange the items nicely.
Done.
I would like to highlight a part of text in a UITextView like Pages for iOS or Safari for iOS do. I search the documentation but I can't find a way to do it, maybe because I'm a beginner in iOS development and I miss some crucial info. Somebody can help me?
Screenshot of Pages for iOS:
Screenshot of Safari for iOS:
If you only need to highlight a single, contiguous block of text you can set the selection programmatically. Your examples show multiple discontinuous parts however. For that you are going to need to use an attributed string. There is no other system-provided highlighting function. (There might be a third party library that offers this though - you'll have to search.)
I am currently working on an iOS application that is to be used as a museum display. Part of the display concerns a speech by Abraham Lincoln. My client would like me to display the text of the speech with certain words and phrases highlighted. When you click on the highlighted words a popup annotation should appear. The tricky part is that they don't want to use digital text. They want to display the words of the speech in the form of an image taken from a facsimile of Lincoln's own handwriting.
I have a good deal of experience in iOS development, and I think I am up to the task of responding to clicks on the highlighted words with a simple touchesBegan event handler to get the CGPoint of the touch. However, graphics are not my strong suit. I don't have a good idea of what to do about highlighting the words. I imagine I need to use some kind of filter or mask, but I have never done this in iOS before.
Any help is appreciated (and I'm very generous with upvotes). Thanks to everyone!
If you're going to be building up the composite image anyway, how about putting the highlighted text as the image on buttons set on top of the background, with the rest of the text as part of the background image?
If there's no button text, just the image (of the word or phrase) then you're sorted.
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.
Before this question is dismissed, let me start by saying I've read the dozens of questions that sound similar. I haven't found anyone that has asked for this specific use case, though, so I'm going to give it a shot.
I would like to create custom images to use (similar to emojis) in a custom keyboard that can be accessed with the globe icon. I understand that I can create a custom keyboard inside my own app, but it will only work within that app. I also understand how the emoji keyboard works.
Is it possible to create a situation where if two people are using the app, though, that the keyboard could be used to input the custom images (emojis) and be viewed only by a receiving user that ALSO has the app - even if the keyboard is being used outside of the custom image keyboard app.
So, basically, there would be a set of images stored within the app and the custom keyboard would reference those images to display whenever the keystroke has been entered and then the receiving phone can locate those images stored within the app to display them (but this could all be done within the native SMS messaging app, not solely in the new custom image keyboard app).
I've researched this a good deal, but can't find a straight answer. Any help or direction would be greatly appreciated!
You could create your own Keyboard that creates somehow special Strings that imply an image. For example could a smiley be encoded like ".CoolSmiley". When you now want to display that text, you should search for patterns you want to recognise. That's how emoji is working. When you type in (y) it will get replaced by a thumb up image because it's recognising the string as a known pattern for a thumb up. This will of course just work inside your app.