1扬霜、將UISearchBar中的"cancel"修改為"取消" 腕扶,在info.plist文件中添加
<key>CFBundleLocalizations</key>
<array>
<string>zh_CN</string>
</array>
意思是項(xiàng)目默認(rèn)采用中文(非國(guó)際化語言情況下)
2逆瑞、在使用swift時(shí)糟描,如果需要主動(dòng)添加警告:
Build Phases -> + 號(hào) --> New Run Script Phase --> 輸入以下字符:
TAGS="TIPS:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
可以將TAGS后的引號(hào)內(nèi)字符替換成 任意字符怀喉。使用:
// TIPS: 這里需要進(jìn)行修改
3、顯示Mac隱藏文件命令(終端輸入船响,輸入完成之后重啟finder:窗口左上角蘋果->強(qiáng)制退出->finder):
defaults write com.apple.finder AppleShowAllFiles -bool true
隱藏Mac隱藏文件命令:
defaults write com.apple.finder AppleShowAllFiles -bool false
4躬拢、更新本地CocoaPods庫(kù)方案:我們知道在pod setup過程中,pod其實(shí)是在安裝第三方庫(kù)的索引目錄见间,因此我們可以直接從githups上下載索引目錄拷進(jìn)repos文件夾估灿。前往這里 ,下載該索引缤剧,然后拷進(jìn)repos文件夾馅袁。目錄結(jié)構(gòu)如下圖所示:(完全退出終端,重啟終端荒辕,pod功能即可正常使用)汗销。
5、iPhone 各個(gè)版本尺寸對(duì)應(yīng)表
iPhone | Width | Height | Diagonal | 邏輯分辨率(point) | Scale Factor | 設(shè)備分辨率(pixel) | PPI |
---|---|---|---|---|---|---|---|
3GS | 2.4 inches (62.1 mm) | 4.5 inches (115.5 mm) | 3.5-inch | 320x480 | @1x | 320x480 | 163 |
4(s) | 2.31 inches (58.6 mm) | 4.5 inches (115.2 mm) | 3.5-inch | 320x480 | @2x | 640x960 | 326 |
5c | 2.33 inches (59.2 mm) | 4.90 inches (124.4 mm) | 4-inch | 320x568 | @2x | 640x1136 | 326 |
5(s) | 2.31 inches (58.6 mm) | 4.87 inches (123.8 mm) | 4-inch | 320x568 | @2x | 640x1136 | 326 |
6 | 2.64 inches (67.0 mm) | 5.44 inches (138.1 mm) | 4.7-inch | 375x667 | @2x | 750x1334 | 326 |
6+ | 3.06 inches (77.8 mm) | 6.22 inches (158.1 mm) | 5.5-inch | 414x736 | @3x | (1242x2208->)1080*1920 | 401 |
7 | 2.64inches (67.1 mm) | 5.44 inches (138.3 mm) | 4.7-inch | 375x667 | @2x | 750x1334 | 326 |
7+ | 3.07 inches (77.9 mm) | 6.23 inches (158.2 mm) | 5.5-inch | 414x736 | @3x | 1080x1920 | 401 |
8 | 2.65inches (67.3 mm) | 5.45 inches (138.4 mm) | 4.7-inch | 375x667 | @2x | 750x1334 | 326 |
8+ | 3.07 inches (78.1 mm) | 6.24 inches (158.4 mm) | 5.5-inch | 414x736 | @3x | 1080x1920 | 401 |
X | 2.79 inches (70.9 mm) | 5.65 inches (143.6 mm) | 5.8-inch | 375x812 | @3x | 1125x2436 | 458 |
XR | 2.98 inches (75.7 mm) | 5.94 inches (150.9 mm) | 6.1-inch | 414x896 | @2x | 828x1792 | 326 |
XS | 2.79 inches (70.9 mm) | 5.65 inches (143.6 mm) | 5.8-inch | 375x812 | @3x | 1125x2436 | 458 |
XS Max | 3.05 inches (77.4 mm) | 6.20 inches (157.5 mm) | 6.5-inch | 414x896 | @3x | 1242x2688 | 458 |
6抵窒、Xcode提示:
- 方法或?qū)傩缘淖⑨專?/li>
+ (void)shareToWeChat; /**< 微信分享*/
或者
+ (void)shareToWeChat; ///<發(fā)送按鈕
在調(diào)用時(shí)可以得到提示
- 添加提示信息
#error <錯(cuò)誤提示>
#warning <警告提示>
7弛针、如何處理使用CAShapeLayer
的UIBezierPath
構(gòu)造圖形時(shí)造成的圖像模糊
shapeLayer.rasterizationScale = 2.0 * [UIScreen mainScreen].scale;
shapeLayer.shouldRasterize = YES;
請(qǐng)注意,rasterizationScale默認(rèn)為1.0李皇,即使在視網(wǎng)膜設(shè)備上削茁,它考慮了默認(rèn)的shouldRasterize的模糊性。這將以2x屏幕刻度光柵化路徑掉房,在視網(wǎng)膜設(shè)備上最多為4.0茧跋。
引用自 https://codeday.me/bug/20170724/42571.html
原來來自stackoverflow
8、開發(fā)過程中卓囚,NSString
轉(zhuǎn)CGFloat
使用duobleValue
能保證數(shù)值的精確度