This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIImage (Transform) | |
- (UIImage *)imageAtRect:(CGRect)rect; | |
- (UIImage *)imageByScalingProportionallyToMinimumSize:(CGSize)targetSize; | |
- (UIImage *)imageByScalingProportionallyToSize:(CGSize)targetSize; | |
- (UIImage *)imageByScalingToSize:(CGSize)targetSize; | |
- (UIImage *)imageRotatedByRadians:(CGFloat)radians; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SyncService::sync() | |
{ | |
QUrl url(SYNC_URL); | |
QNetworkRequest request(url); | |
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); | |
QNetworkAccessManager *manager = new QNetworkAccessManager(this); | |
connect(manager, SIGNAL(finished(QNetworkReply*)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION = build | |
AD_HOC_CODE_SIGNING_ALLOWED = NO | |
ALTERNATE_GROUP = staff | |
ALTERNATE_MODE = u+w,go-w,a+rX | |
ALTERNATE_OWNER = grantdavis | |
ALWAYS_SEARCH_USER_PATHS = NO | |
ALWAYS_USE_SEPARATE_HEADERMAPS = YES | |
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer | |
APPLE_INTERNAL_DIR = /AppleInternal | |
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>method</key> | |
<string>app-store</string> | |
<key>teamID</key> | |
<string>XXXXXXXXXX</string> | |
<key>uploadBitcode</key> | |
<true/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# qmake 要么在 bin 的可执行文件下, 要么 alias 它的可执行文件路径 | |
qmake xx.pro -spec macx-xcode | |
# ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild | |
# 如果出现上面的报错,要修改 `Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf` | |
# 替换 `isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))` | |
# 为 `isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Core Animation 优点为:①单独进程运行 ②不会阻塞主线程。缺点为:①复杂动画效果要写冗长的代码 ②手势驱动动画比较复杂。 | |
pop 的优点为:①丰富的 API ②内置很多的动画 缺点为:①在主线程上执行 ②动画过程可能卡顿 ③消耗更高的 CPU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL RCTIsMainQueue() | |
{ | |
static void *mainQueueKey = &mainQueueKey; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
dispatch_queue_set_specific(dispatch_get_main_queue(), | |
mainQueueKey, mainQueueKey, NULL); | |
}); | |
return dispatch_get_specific(mainQueueKey) == mainQueueKey; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iOS动画应用内处理的4个阶段 | |
在iOS中,动画的执行主要分6个阶段,其中4个阶段是在应用内部处理的: | |
Layout: 这一阶段是准备好view/layer的层级结构并设置layer的属性; | |
Display: 这一阶段将绘制layer的内容。绘制操作会调用-drawRect:或-drawLayer:inContext:方法; | |
准备阶段: 这一阶段是Core Animation准备将动画数据发送给render server。另外,还会执行其它一些操作,如解压在动画过程中显示的图片; | |
提交: 这是应用内部处理的最后一个阶段,Core Animation将打包layer及动画属性并通过IPC发送到render server; | |
这几个阶段都是由CPU来处理的,而且我们只能控制前面两个阶段,后两个阶段将由Core Animation来控制。 |