#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