本人2007年大学毕业,为生计所迫,先就职于某世界大工厂,终日游手好闲,无所事事,料想如此三年五年下去,必定前程荒废,不得翻身。自觉对不住大学期间的学费,更无颜面对乡下日夜辛劳的父母。于是决定转战他行。遂于2008年10月结束合约,获得解放。 11月开始投身iPhone开发,算是国内较早的开发者。由于昔日的老本荒废已久,本来就没有太多编程经验,外加新生事物的参考资源甚少,中间困难重重。常混迹于国内外各大论坛和博客,每当发现一点有价值的东西总是迫不及待地收藏下来,万分珍惜。期间,感谢各位达人的鼓励,提点,砖拍,甚至冷嘲热讽。这样一年多下来,积累了一些经验,从构架到代码,从程序,发布到营销逐... Read More
UIWindow *myWindow = [[UIWindow alloc] initWithFrame:[UIApplication sharedApplication].statusBarFrame]; [myWindow setBackgroundColor:[UIColor clearColor]]; [myWindow setWindowLevel:UIWindowLevelStatusBar]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(280.0f, 5.0f, 10.0f, .. Read More
下面这段代码可以实现邻近检测功能,当你的身体靠近iPhone而不是触摸的时候,iPhone将会做出反应。(需要一定的面的影射,约5mm左右的时候就会触发)在程序初始化处,添加一个监听UIDevice *device = [UIDevice currentDevice];device.proximityMonitoringEnabled = YES;if (device.proximityMonitoringEnabled ==YES)[[NSNotificationCenter defaultCenter]addObserver:selfselector:@selector(proximity Read More
#import <Foundation/Foundation.h>@interface CheckButton : UIButton { BOOL _checked;}@property (nonatomic, setter=setChecked) BOOL checked;-(void) setChecked:(BOOL) check;@end#import "CheckButton.h"@implementation CheckButton@synthesize checked = _checked;-(id) init{ if( self=[super i Read More
UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"I'm a Chinese!" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Okay",nil] autorelease]; [theAlert show]; /* for(UIView *view in [theAlert subviews]){ ... Read More
#import <Foundation/Foundation.h>@interface NSArray (DERandomization)+ (NSArray *)randomArrayFromArray:(NSArray *)sortedArray;@end#import "NSArray+DERandomization.h"@implementation NSArray (DERandomization)+ (NSArray *)randomArrayFromArray:(NSArray *)sortedArray { NSMutableArray *toR Read More
#import <UIKit/UIKit.h>@interface BlueBadge : UIView { NSInteger count;}@property (nonatomic) NSInteger count;- (void)drawWithCount:(NSInteger)i;@end#import "BlueBadge.h"@implementation BlueBadge@synthesize count;- (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:fra Read More
定位某行的错误#define ZNLog(s,...) [ZNLog file:__FILE__ function: (char *)__FUNCTION__ lineNumber:__LINE__ format:(s),##__VA_ARGS__]#import <Foundation/Foundation.h>@interface ZNLog : NSObject {}+(void)file:(char*)sourceFile function:(char*)functionName lineNumber:(int)lineNumber format:(NSString*)fo Read More
RT:-(float)getTotalDiskSpaceInBytes { float totalSpace = 0.0f; NSError *error = nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] e... Read More
1.Combine two UIImages-合成To add two UIImages together you need to make use of Graphics Context.- (UIImage *)addImage:(UIImage *)image1 toImage:(UIImage *)image2 { UIGraphicsBeginImageContext(image1.size); // Draw image1 [image1 drawInRect:CGRectMake(0, 0, image1.size.width, image1.size.height)... Read More