learningTips
- Eight common regular expressions
Address code.tutsplus.com/tutorials/8…
- in
OC
“, can be usedGUN C
Declaration extensions to limit scoping while simultaneously performing assignments, which, when used properly, can make code more compact and tidy. Like initializationtitleLabel
self.titleLabel = ({
UILabel *label = [[UILabel alloc]
initWithFrame:CGRectMake(150, 30, 20, 40)];
label.textColor = [UIColor redColor];
label.text = @"Title";
[view addSubview:label];
label; });
Copy the code
- Compression image algorithm
import cv2 def compression(pathin, pathout, level): # (" before compression address ", "after compression address ", compression level [0, Imwrite (pathout, img, [cv2.imwrite_jpeg_quality, int(level)]) img = cv2.imread(pathin, 1) cv2.imwrite(pathout, img, [cv2.imwrite_jpeg_quality, int(level)])Copy the code
Swift
One-line implementationUIButton
Picture on the right, text on the left
btn.semanticContentAttribute = .forceRightToLeft
Copy the code
SemanticContentAttribute is an inversion, which describes the contents of a view and is used to determine whether the layout should be flipped left to right and right to left when switching between views, with minimum support up to 9.0
Problems encountered
- App ICONS cannot be displayed after ios 15 is upgraded
I had a Beta version of ios14 on my phone and hadn’t updated it for a long time. Recently the ios15 system came out, and we upgraded the latest system, but there was a problem. It was normal to download our App ICONS from the App Store before, but after downloading this time, the App ICONS could not be displayed, and the grid was directly displayed. Repeatedly delete and download many times, still so. No good solution has emerged from searching the Internet. I later tried to shut down and restart the try, is ok, but re-download or real machine debugging, and become a grid, is very big. However, after the recent upgrade of ios15.0.1, there is no abnormal icon display problem after downloading from the App Store again. This is hereby recorded here. I hope students who encounter the same problem can refer to this solution to solve it. Of course, if any students know what is the cause of this, I hope you can kindly comment, thank you very much.
swift
The use ofsnpKit
The program crashed while updating the constraint
In OC, updateConstraints would be able to update a single constraint by using mas_updateConstraints, but in Swift, updateConstraints might crash. Instead of using updateConstraints to update the constraints in swift, use remakeConstraints to place the constraints again in the following code:
Code before update
self.topBtn.snp.makeConstraints{
$0.leading.equalTo(self.contentView).offset(fitWidth(width: 20))
$0.top.equalTo(self.contentView).offset(fitWidth(width: 16))
$0.width.greaterThanOrEqualTo(fitWidth(width: 50))
$0.height.equalTo(fitWidth(width: 36))
}
Copy the code
Update the layout code
self.topBtn.snp.remakeConstraints{
$0.leading.equalTo(self.contentView).offset(fitWidth(width: 20))
$0.top.equalTo(self.contentView).offset(fitWidth(width: 16))
$0.width.greaterThanOrEqualTo(fitWidth(width: 100))
$0.height.equalTo(fitWidth(width: 36))
}
Copy the code
Tools recommended
- Free ebook downloads, computer related books,
pdf
version
Address: www.jb51.net/books/
- Compressed video software, parameters can be configured, very convenient
Address pan.baidu.com/s/1MN7Cj6WV… Password: FNBT