Skip to content

Instantly share code, notes, and snippets.

@fhefh2015
fhefh2015 / new_gist_file.css
Created March 10, 2016 03:51
css box-sizing
.border_box {
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
@fhefh2015
fhefh2015 / new_gist_file
Created March 10, 2016 08:10
how to set focus to textfield
[textfield becomeFirstResponder];
@fhefh2015
fhefh2015 / new_gist_file
Last active March 13, 2016 07:12
iOS数据持久化
//
// ViewController.m
// 数据持久化
//
// Created by fhefh on 16/3/13.
// Copyright © 2016年 fhefh. All rights reserved.
//
#import "ViewController.h"
@fhefh2015
fhefh2015 / gist:aa582d97fe0bc7550e3c
Last active March 17, 2016 01:29 — forked from ethanbing/gist:10970615
iOS 常用数学函数
1、 三角函数 
  double sin (double);正弦 
  double cos (double);余弦 
  double tan (double);正切 
  2 、反三角函数 
  double asin (double); 结果介于[-PI/2, PI/2] 
  double acos (double); 结果介于[0, PI] 
  double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2] 
  double atan2 (double, double); 反正切(整圆值), 结果介于[-PI, PI] 
  3 、双曲三角函数 
@fhefh2015
fhefh2015 / Quartz2D.md
Created March 17, 2016 10:18 — forked from ldong/Quartz2D.md
Quartz 2D

Quartz 2D Notes

  CGContextRef context = ();
    //设置起始点
    CGContextMoveToPoint (context, 160, 100);
    CGContextAddLineToPoint (context, 100, 180);
    CGContextAddLineToPoint (context, 160, 180);
    // 设置边界
    [[UIColor blackColor] setStroke];
@fhefh2015
fhefh2015 / new_gist_file
Last active March 21, 2016 05:58
图片添加水印
//
// ViewController.m
// 图片水印
//
// Created by fhefh on 16/3/21.
// Copyright © 2016年 fhefh. All rights reserved.
//
#import "ViewController.h"
@fhefh2015
fhefh2015 / DataBaseHandler.h
Last active March 25, 2016 02:34
sqlite3简易封装
//
// DataBaseHandler.h
// 代码:http://www.jianshu.com/p/a02479cc5e15
//
#import <Foundation/Foundation.h>
#import <sqlite3.h>
@interface DataBaseHandler : NSObject
{
@fhefh2015
fhefh2015 / new_gist_file
Created March 30, 2016 02:43
屏幕截图
//
// ViewController.m
// 图片截屏
//
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *picView;
@fhefh2015
fhefh2015 / new_gist_file
Created April 20, 2016 03:23
GCD常用函数
//延迟执行任务函数dispatch_after
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
NSLog(@"start");
//dispatch_after 是异步执行的
//队列只决定在哪个线程中执行任务 并不能决定执行时间
/**
* 第一个参数: 在哪个时间点执行
* dispatch_time(从哪个时间点开始,经历多少纳秒)
* 第二个参数: 在哪个队列中执行block任务
* 第三个参数: block任务
@fhefh2015
fhefh2015 / new_gist_file
Created May 6, 2016 06:24
iPhone获取状态栏和导航栏尺寸(宽度和高度)
// 状态栏(statusbar)
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"status width - %f", rectStatus.size.width); // 宽度
NSLog(@"status height - %f", rectStatus.size.height); // 高度
// 导航栏(navigationbar)
CGRect rectNav = self.navigationController.navigationBar.frame;
NSLog(@"nav width - %f", rectNav.size.width); // 宽度
NSLog(@"nav height - %f", rectNav.size.height); // 高度