Skip to content

Instantly share code, notes, and snippets.

@siqin
siqin / gist:1aee16b3be1370256f67
Created July 22, 2014 05:58 — forked from jdewind/gist:1472295
create a universal framework
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 02:01
NSMutableString+UBBParser
#import <Foundation/Foundation.h>
@interface NSMutableString (UBBParser)
- (void)enumUBBTag:(NSString *)ubbTag usingBlock:(void (^)(NSRange tagRange,
NSString *tagContent,
NSMutableString *currentStr,
BOOL *stop))block;
@end
// 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 November 21, 2013 11:10
SwipeNavigationController
//
// 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 April 25, 2013 10:04
Perfectly following keyboard height change.
#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 December 4, 2012 07:57
Remove Emoji in NSString
// 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){
@siqin
siqin / Path-Style-Menu.m
Created October 9, 2012 08:46
Path-Style Menu
//
// 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 September 28, 2012 08:35
iOS-App-Launch-Animation
- (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 September 28, 2012 08:33
Fade In and Fade Out
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];
@siqin
siqin / RunLoopObserver.m
Created August 14, 2012 13:10
RunLoop Observer
#pragma mark - RunLoop Observer
- (void)onNewThread:(id)info
{
NSRunLoop *runloop = [NSRunLoop currentRunLoop];
if (!runloop) {
return ;
}
if (runloop == [NSRunLoop mainRunLoop]) {