Skip to content

Instantly share code, notes, and snippets.

View cxjwin's full-sized avatar
💭
I may be slow to respond.

SmartCai cxjwin

💭
I may be slow to respond.
View GitHub Profile
@cxjwin
cxjwin / UIImage+TintColor.h
Created April 22, 2019 02:59
UIImage with tint color
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIImage (TintColor)
- (UIImage *)imageWithOriginalImage:(UIImage *)image
tintColor:(UIColor *)tintColor;
@end
+ (void)deactivateAppForDuration:(NSTimeInterval)duration
{
//如果kif框架此方法支持了iOS11可以去掉此判断,执行kif的方法
// if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0) {
// UIApplication *application = [UIApplication sharedApplication];
// [application.delegate applicationWillResignActive:application];
// [application.delegate applicationDidEnterBackground:application];
// [tester waitForTimeInterval:duration];
// [application.delegate applicationWillEnterForeground:application];
// [application.delegate applicationDidBecomeActive:application];
@cxjwin
cxjwin / mach_absolute_time
Last active August 27, 2018 08:05
mach_absolute_time()
#include <mach/mach_time.h>
/* Get the timebase info */
mach_timebase_info_data_t info;
mach_timebase_info(&info);
uint64_t start = mach_absolute_time();
/* Do some code */
@cxjwin
cxjwin / universal-framework.sh
Created February 5, 2017 03:25 — forked from cromandini/universal-framework.sh
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool (including all the Swift module architectures).
#!/bin/sh
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
`DirectoryMonitor` is used to monitor the contents of the provided directory by using a GCD dispatch source.
*/
import Foundation
# Mac
.DS_Store
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
@cxjwin
cxjwin / .gitignore
Last active August 29, 2015 14:22 — forked from adamgit/.gitignore
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.3
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#