Skip to content

Instantly share code, notes, and snippets.

@siqin
siqin / gist:1aee16b3be1370256f67
Created Jul 22, 2014 — forked from jdewind/gist:1472295
create a universal framework
View gist:1aee16b3be1370256f67
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" &&
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" &&
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal" &&
UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}" &&
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}.framework" &&
# Create framework directory structure.
rm -rf "${FRAMEWORK}" &&
mkdir -p "${UNIVERSAL_LIBRARY_DIR}" &&
mkdir -p "${FRAMEWORK}/Versions/A/Headers" &&
@siqin
siqin / NSMutableString+UBBParser.h
Created May 23, 2014
NSMutableString+UBBParser
View NSMutableString+UBBParser.h
#import <Foundation/Foundation.h>
@interface NSMutableString (UBBParser)
- (void)enumUBBTag:(NSString *)ubbTag usingBlock:(void (^)(NSRange tagRange,
NSString *tagContent,
NSMutableString *currentStr,
BOOL *stop))block;
@end
View PSPDFUIKitMainThreadGuard.m
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2013 Peter Steinberger. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
@siqin
siqin / SwipeNavigationController.h
Created Nov 21, 2013
SwipeNavigationController
View SwipeNavigationController.h
//
// SwipeNavigationController.h
// cdNBA
//
// Created by Jason Lee on 13-9-17.
// Copyright (c) 2013年 Jason Lee. All rights reserved.
//
#import <UIKit/UIKit.h>
@siqin
siqin / observeKeyboardChange_iOS
Created Apr 25, 2013
Perfectly following keyboard height change.
View observeKeyboardChange_iOS
#pragma mark - reg & unreg notification
- (void)regNotification
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
}
- (void)unregNotification
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillChangeFrameNotification object:nil];
@siqin
siqin / gist:4201667
Created Dec 4, 2012
Remove Emoji in NSString
View gist:4201667
// XCode 4.2.1
@implementation NSString(EmojiExtension)
- (NSString*)removeEmoji {
__block NSMutableString* temp = [NSMutableString string];
[self enumerateSubstringsInRange: NSMakeRange(0, [self length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop){
View Path-Style-Menu.m
//
// ViewController.m
// PathStyleMenu
//
// Created by Jason Lee on 12-10-9.
// Copyright (c) 2012年 Jason Lee. All rights reserved.
//
#import "ViewController.h"
@siqin
siqin / gist:3798664
Created Sep 28, 2012
iOS-App-Launch-Animation
View gist:3798664
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
UIImageView *splashScreen = [[[UIImageView alloc] initWithFrame:self.window.bounds] autorelease];
splashScreen.image = [UIImage imageNamed:@"Default"];
@siqin
siqin / fade.m
Created Sep 28, 2012
Fade In and Fade Out
View fade.m
CATransform3D transform = CATransform3DMakeScale(0.001, 0.001, 1.0);
hintView.layer.transform = transform;
hintView.alpha = 0;
transform = CATransform3DMakeScale(1.0, 1.0, 1.0);
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
hintView.layer.transform = transform;
hintView.alpha = 1;
[UIView commitAnimations];
View RunLoopObserver.m
#pragma mark - RunLoop Observer
- (void)onNewThread:(id)info
{
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
if (!runloop) {
return ;
}
if (runloop == [NSRunLoop mainRunLoop]) {
You can’t perform that action at this time.