1. Learning swift and core graphics

Original link:current page

These days I surfed web for the ways to draw the graphics on iOS, the Core Graphics is the best way suits my need.
At this time I also find a good blog, here is the link: https://www.cnblogs.com/kenshincui/.

After attempting to read the present code from website, I gave up the Object-C code, which is difficult to read and understand. So I try the swift, I had read this article:https://www.cnblogs.com/kenshincui/p/3959951.html, but its environment is too old to run in my Mac, and I decide to learn the swift and Core Graphics.

A excellent website to learn swift: https://www.raywenderlich.com/411-core-graphics-tutorial-part-1-getting-started, now I follow the steps in this website and program in my Mac, you can download the sourecode from this website.

The environment:

  • Xcode: 10.1

Draw the button, as far, it works:

And the other button next, the stroke, the text…
now, you can get this:

But there is a problem:

when you push the add button, and then push the minus button, you will find the stroke don't work properly, but it doesn't matter.

From now on, I knew

how to create a xcode project
how to add the object to my apps
how to connect the variable with the object

It is not enought.
So, I continue the second part of this tutorial, the link is:https://www.raywenderlich.com/410-core-graphics-tutorial-part-2-gradients-and-contexts.

This second part is to introduce the Core Graphic. After finished this lesson, I get this application:

Err…Something dislocation error in it, and others, no matter.
I knew how to draw lines with Core Graphic – the most important.

OK, the swift and Core Graphic are ready, maybe.
The next should be the Bluetooth Lowpower Energy – BLE. I should know how it works on iOS application.


  • Last modified: 2019/08/23 12:17