This question already has answers here:
How to Make a Secret iOS App Text Animation
(4 answers)
Closed 8 years ago.
What's the best way to fade in individual letters of a UILabel over time? I'm looking to create something similar to the example below.
http://s11.postimg.org/5s16qmwn5/secret.gif
I wouldn't use UILabel to do this.
I would create a UIView with CATextLayers inside it, one text layer for each character. Then you can animate the text layers independently.
Check out apple's WWDC videos on core animation to learn how it works. It's very simple.
You may want to use NSAttributedText to create your own UITextView or UILabel that does that, basically randomly assigning UIColors with decreasing Alpha to different letters,
It will take a while to find the correct speed and rate of change. Open source it then :)
Related
This question already has answers here:
UISlider - missing features - snap, tooltip and ticks
(2 answers)
iOS UISLider with gradient layer
(1 answer)
Closed 4 years ago.
I am trying to create a UISlider with a track broken up into sections. Is it possible to break up the track and have each section be a different color? Rather than just min track and max track
Is it possible to break up the track and have each section be a different color?
When you want to know what a built-in interface object will do, consult the documentation (e.g. https://developer.apple.com/documentation/uikit/uislider). You will readily learn that the built-in slider control itself can't do what you describe. But you can. For example, you could make a clear track and put the sectioned view behind it, or create your own slider control that draws the way you want it. There are lots of online explanations about how to write a customized version of a slider.
This question already has answers here:
How to add toggleBoldface option to a UITextView in iOS?
(2 answers)
Closed 5 years ago.
I have been searching for quite a while for a solution as to how to grant users the ability to underline, italicize and bold text in a UITextView but have not been able to find a solid solution. I have realized that I will need to use an NSAttributedString but am not sure as to how to create the UI and format the string so I am able to save it to a database. If you could point me in a proper direction that would be greatly appreciated. Thanks!
The UI is simply an ordinary editable UITextView with allowsEditingTextAttributes set to true.
How you save is up to you, but the most universal solution is probably to pull out the UITextView's attributedText, archive it into an NSData (now known as Data in Swift), and save it off.
This question already has answers here:
What's the difference between setBackgroundImage:Forstate and setImage:Forstate:
(3 answers)
Closed 7 years ago.
I am trying to implement a radio button feature in my app and I am switching between images using the setBackgroundImage:forControlState method and it is working fine.
However, I can see another method setImage:forControlState and wondering when to use setImage and when to use setBackgroundImage.
Basically what is difference between these two methods in terms of functionality.
The UIButton documentation does not tell you what are the differences between these two methods.
Experimenting uncovers one interesting difference: if you change the button’s frame, background images follow the size change, while images keep their original size.
Take your pick.
So simple, if you use setImage actually you say that 'I'll use an image for whole button components.' and will not able to set title etc. If you use setBackgroundImage, you say that 'I'll use an image for just background of button components.' and able to set title etc.
This question already has answers here:
Autoscrolling in a UIScrollview
(3 answers)
Closed 8 years ago.
I have already asked the same question a few time but I have had no answer.
I would like to know if someone can help me get a UIScrollview to autoscroll down the page with an incrementally faster speeds.
I also have buttons on the page.
It would also be great when the user touches a button on the page it keeps autoscrolling.
So if you kind of understand it will be like the game Piano Tiles.
I am running Xcode 5. If someone has the solution to my problem please can you tell me what code goes where as I am quite a newby Xcode.
Your help will be greatly appreciated.:)
I suspect the Piano Tiles game is actually using something like Sprite Kit.
This allows a lot more control over thing like "scrolling" speed.
Instead of using a UIScrollView you would use an SKNode as a layer with the buttons added to that parent layer.
Then using the update game loop you can incrementally increase the speed of the movement based on the time since the game started.
In essence... don't use UIScrollView, don't use UIKit, use SpriteKit.
This question already has answers here:
How do you remove links from UIWebView?
(2 answers)
Closed 8 years ago.
I have a long text paragraph in which there is a string similar to "123/456/789". When I tried to use UIWebView to display it, the UIWebView always insert something like there is a web link there (an extra underscore and blue color, like 123/456/789 with underscore). But I only want the normal black color just like others. Why does UIWebView add those "link" automatically? How can I avoid that?
Thanks,
Steve
Sounds like the work of a data detector. The web view can automatically detect certain kinds of data, like phone numbers, and make them tappable links. This is often nice, because it's much easier to tap a phone number to make a call than to have to remember it and dial it yourself.
You can specify which types of data the web view should detect by setting its dataDetectorTypes property.