Skip to content

Instantly share code, notes, and snippets.

View aidenluo177's full-sized avatar

aidenluo aidenluo177

  • 36Kr
  • Beijing
View GitHub Profile
93Vj5a8FJaIuac1a+4oPo+RSZZBDSVBb
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// setup initial state (e.g. before animation)
cell.layer.shadowColor = [[UIColor blackColor] CGColor];
cell.layer.shadowOffset = CGSizeMake(10, 10);
cell.alpha = 0;
cell.layer.transform = CATransform3DMakeScale(0.5, 0.5, 0.5);
cell.layer.anchorPoint = CGPointMake(0, 0.5);
// define final state (e.g. after animation) & commit animation
[UIView beginAnimations:@"scaleTableViewCellAnimationID" context:NULL];
@aidenluo177
aidenluo177 / CircleImage
Created April 9, 2015 10:05
Circle Image
CGRect frame = CGRectMake(0.0f, 0.0f, diameter, diameter);
UIImage *newImage = nil;
UIGraphicsBeginImageContextWithOptions(frame.size, NO, [UIScreen mainScreen].scale);
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
UIBezierPath *imgPath = [UIBezierPath bezierPathWithOvalInRect:frame];
[imgPath addClip];
@aidenluo177
aidenluo177 / API.md
Last active August 29, 2015 14:13 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

#import "UIControl+AD_SafeUIControl.h"
#import <objc/runtime.h>
@implementation UIControl (AD_SafeUIControl)
- (void)AD_sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event
{
if (![target respondsToSelector:action]) {
return;
}
[self AD_sendAction:action to:target forEvent:event];
}
@aidenluo177
aidenluo177 / SnapShot
Last active August 29, 2015 14:08
Snap OpenGL content
-(void)snapUIImage
{
int s = 1;
UIScreen* screen = [ UIScreen mainScreen ];
if ( [ screen respondsToSelector:@selector(scale) ] )
s = (int) [ screen scale ];
const int w = self.frame.size.width;
const int h = self.frame.size.height;
const NSInteger myDataLength = w * h * 4 * s * s;
@aidenluo177
aidenluo177 / Nobug.js
Last active August 29, 2015 14:07
Nobug.js
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \