Writing effect for UILabel text (iOS objective c) - ios

I want to give a effect for UILabel text that will look exactly same like we are writing on a paper using pen. I searched for it but not getting any related suggestion/solutions, there are solutions like typing effect but not as I need.

The only way to accomplish this is to manually draw the stroked for the inserted letters via a graphics API (Core Graphics, OpenGL, etc.). You cannot accomplish this without manual drawing. It is possible that there's a 3rd party library that can help you with this. You can use a tool like PaintCode to extract the bezier paths and what not to help you manually drag glyphs for each letter in an alphabet and then animate those paths using Core Animation or another graphical drawing mechanism.

Related

PKDrawing: Text to PKStroke

I would like to add text to a PKDrawing
Apple actually demonstrates this use case in their WWDC2020 video: https://developer.apple.com/videos/play/wwdc2020/10148
However, looking at the sample code, they simply recorded previously drawn text
Anyone familiar with fonts and vector formats: what would be a good approach to converting a single system font to PKStroke for adding to a PKDrawing?
your best bet is to add a custom UIView into the background of PKCanvasView and handle the drawing there, where you have 100% freedome
Turning a UIFont into a representation of PKDrawing would be almost impossible to get right, as PKDrawing/PKStroke represent Pen input (the only way i could thing of would be to fake a solid drawn rectangle and use the mask bezier to cut out the letter(s))

Have to develop the component shown in below image

Need to develop the component shown in the image above using Objective-C language. No idea where to start and which framework to use. Any heads up/reference links to develop this component is highly appreciated.
Use a combination of UIBezierPaths with custom fill colors. You can either use a shape layer or core graphics. Bezier path allows you to construct a custom path, so the first one will be a triangle, and the second a quadrilateral.
You could also use paint code if you want to construct the path visually.
Look at this
https://www.raywenderlich.com/76433/how-to-make-a-custom-control-swift
It's a very general way to create whatever control you want.

graph paper interaction in swift/iOS

I'm picturing a graph paper like interface, as you click on any given box within the graph it gets colored in. I'm doing this to draw rough shape outlines.
My question is what is the best approach to do this? Draw the lines for the graph and track where the touches occur and color accordingly? Make some array of buttons? Maybe using spritekit?
I'm not too worried about efficiency as I'm not doing anything too complicated but I'm just trying to find some common design ideas behind it.
Something visually similar to this.
You can accomplish some pretty complex behaviours with a UICollectionView and a custom layout. UICollectionView is nice because it manages taps and drawing each cell individually, which should vastly simplify things for you.

UIImageView Annotation

I am trying to capture an Image from Camera show it on the UIImageView.
After that I have some buttons for e.g. "Paint Brush", "Eraser", "Undo", "Save".
Using Brush I want to mark some items on the image captured.
What is the best way to accomplish the annotation and then save the image.
I am not sure what should be used. Should I use touchesbegan/end etc.. or some other alternative.
Regards,
Nirav
U need to understand Bézier Path Basics.Search it on Google or Apple Documentation.
The UIBezierPath class is an Objective-C wrapper for the path-related features in the Core Graphics framework. You can use this class to define simple shapes, such as ovals and rectangles, as well as complex shapes that incorporate multiple straight and curved line segments.

What is better way to draw a custom button?

I need to have a few buttons in my iPhone app (which may be then ported to iPad). I know at least 2 methods for making such buttons:
1. Using usual UIButton with an image as a background which can be drawn in any graphics editor.
2. Subclassing UIButton and implementing own drawRect: method using CoreGraphics tools.
I don't know why, but I tend to use the second one, since it seems to be more difficult and lower performing.
Am I right thinking that when implementing the button drawing programmatically, it becomes "cross platform" so that you don't need several icons for different resolutions?
If that is really simple icon, some bezier curve or circle filled with color. Will it still preform slower than an image-button?
And does somebody know any tool which has a graphical interface for drawing a vector image, and than converts it to the CoreGraphics code which one can paste into the drawRect: method?
Thank you.
Don't worry for using drawRect. Unlike Windows, iOS caches the results into a bitmap and will only redraw it when the dimensions of the view change (which is what you actually want - since you want to scale it again).
As for a vector app, you can use Opacity. It has an option to export the icon into CoreGraphics source code: http://likethought.com/opacity/

Resources