Skip to content

Instantly share code, notes, and snippets.

View piaoapiao's full-sized avatar

piaoapiao

  • china shanghai
View GitHub Profile
@piaoapiao
piaoapiao / gist:4394151
Last active December 10, 2015 06:28
black edge text ios
black edge text ios
http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text
http://stackoverflow.com/questions/8224335/crop-uiimage-as-screen-size
截图
@piaoapiao
piaoapiao / gist:4194312
Created December 3, 2012 11:26
12306 code
https://mygod-go-home.googlecode.com/svn/trunk/
http://bbs.csdn.net/topics/390269242?page=1#post-392825144 这里有下载的
-(void)paste:(id)sender
{
UIPasteboard *board = [UIPasteboard generalPasteboard];
NSArray *arr = board.strings;
NSLog(@"string:%@",[board.strings objectAtIndex:0]);
}
- (void)viewDidLoad
{
[super viewDidLoad];
@piaoapiao
piaoapiao / gist:4116739
Created November 20, 2012 08:31
check VerifyCode
-(NSString *)checkVerifyCode:(NSString *)code
{
code = [code stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if([code isEqualToString:@""])
{
return @"验证码不能为空";
}
NSString *verifyCodeRegex = [NSString stringWithFormat:@"([a-z,A-Z,0-9]{6})"];
NSPredicate *verifyCodeTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", verifyCodeRegex];
@piaoapiao
piaoapiao / gist:4111158
Created November 19, 2012 15:05
uibutton
#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
@end
@implementation ViewController
-(void)go:(id)sender
{
NSLog(@"GGGG");
@piaoapiao
piaoapiao / gist:4103404
Created November 18, 2012 03:51
Open NSURL
NSURL *url = [NSURL URLWithString:@"http://maps.google.com/maps?q=pizza"]; [[UIApplication sharedApplication]openURL:url];
NSString *url = @"mailto:846745250@qq.com?subject=User Feedback!&body=fuck you";
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunesconnect.apple.com"]];
@piaoapiao
piaoapiao / gist:4076481
Created November 15, 2012 03:31
iOS 运行图
http://cc.cocimg.com/cms/uploads/allimg/100707/8_100707152949_1.jpg
http://www.cocoachina.com/newbie/basic/2010/0707/1821.html
@piaoapiao
piaoapiao / gist:3956562
Created October 26, 2012 02:21
archive
int buf = 0x12121212;
NSData *data=[[NSData alloc]initWithBytes:&buf length:4];
NSString *string=[[NSString alloc]initWithString:@"dsfasdf"];
NSArray *array=[[NSArray alloc]initWithObjects:@"first",@"second",[NSNumber numberWithInt:123], nil];
NSMutableArray *array2=[[NSMutableArray alloc]initWithObjects:@"first",@"second",[NSNumber numberWithInt:123], nil];
[array2 addObject:array];
[array2 addObject:data];
NSDictionary *dictionary = [[NSDictionary alloc] initWithObjectsAndKeys:@"abc",@"first",@"def",@"second" , nil];
http://www.cocoachina.com/newbie/tutorial/2011/1025/3420.html
http://blog.csdn.net/favormm/article/details/6858330
第一种方法是用系统api的方式获取,如下
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
@piaoapiao
piaoapiao / gist:3898513
Created October 16, 2012 10:21
Asihttp leak
//
// ViewController.m
// testAsihttpModel
//
// Created by wgdadmin on 12-9-8.
// Copyright (c) 2012年 wgdadmin. All rights reserved.
//
#import "ViewController.h"
#import "ASIHTTPRequest.h"