Categories
Swift

iOS correctly set the status bar style color

When developing iOS apps,Many applications need to set the color of the iOS system status bar according to the current App content color,Black or white-especially on iOS 13 After the system supports the black mode。

Normal,Others will tell you to do this:

But this triggers a warning:[crayon[……]

Click link to continue reading...

Categories
Swift

Swift Debug EXC_BAD_ACCESS in AppDelegate

 

Many people will encounter in the development EXC_BAD_ACCESS ,I'm sorry,This time, Xcode does not give any detailed solutions。

usually,This is due to a memory error caused。In simple terms it is that you create an object A,But in the later time of the visit,A memory in this area have been moved to do the system he used,For example, put the object B here - your[……]

Click link to continue reading...

Categories
Swift

Swift strftime use quick format date and time

Processing time and date software development is a very common operation,Almost all programming languages ​​provide a corresponding API to facilitate the development of the date and time to process,Swift is no exception,such as DateFormatter ,You can use it any Date

Click link to continue reading...

Categories
Swift

String.count vs NSString.length

generally speaking,Swift inner String And it is NSString Bridged,For example, I have written String NSString and what difference?,In short we are here to discuss major,String[……]

Click link to continue reading...

Categories
Swift

Swift how to use a dictionary as a paradigm constraints

Today, the group participants Someone made such a problem,Why dictionary type characteristics as the paradigm of the time constraint type,It will inevitably error?

Obviously,He said very clearly,"You can not be from a non-agreement、Non-type class inheritance. "。Obviously,A dictionary is a paradigm structure ......

Then the solution is also very clear ideas,Create[……]

Click link to continue reading...

Categories
Swift

Pocketed X input method is how to deal with the problem of delayed edge of the screen

Problem

Pocketed in the development process input,I have always been plagued by a problem,That is when the user clicks on the left edge of the screen, UIButton of touchDown event almost turned into a [crayon-5[……]

Click link to continue reading...

Categories
Swift

Timer can not update the UI while dragging

In iOS development,We often use Timer This class,For some repeat or delayed call。

but,In actual use,If you are used to periodically update the UI,Will be found Timer Call often[……]

Click link to continue reading...

Categories
Mac OS Swift

Xcode automatic version

Make sure developers have had such trouble:Version submitted wrong!

Version of the compiler and testing more,When the inevitable submitted only to find the wrong version number。Or is the background version number is correct,Reception forget to change the version number。In fact,Allows reception automatically obtain the version number of the background data,For example, this:

But

Background version number[……]

Click link to continue reading...

Categories
Swift

A stack automatically sorted Swift

a year ago,I'm here git onReleased aSwift used to achieve stack,There are two versions。Because Swift itself does not achieve this thing - even though the official part of the tutorial is to use genericsThe StackExamples cited。

Perhaps people think this is too simple, right

In short,This time I play this thing,Because the HMM Viterbi algorithm needs to be done to trim,Otherwise, too many unnecessary path[……]

Click link to continue reading...