This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save the info system button image to where you can access it, this should be able to | |
// go anywhere it gets run by an iPhone program, easiest if you do it with the simulator | |
UIButton *info = [UIButton buttonWithType:UIButtonTypeInfoLight]; | |
NSData *img = UIImagePNGRepresentation([info imageForState:UIControlStateNormal]); | |
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"info.png"]; | |
[img writeToFile:path atomically:NO]; | |
NSLog(@"%@", path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength data:(NSData *)imgData { | |
static const char *encodingTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
const unsigned char *bytes = [imgData bytes]; | |
NSMutableString *result = [NSMutableString stringWithCapacity:[imgData length]]; | |
unsigned long ixtext = 0; | |
unsigned long lentext = [imgData length]; | |
long ctremaining = 0; | |
unsigned char inbuf[3], outbuf[4]; | |
short i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 每次都忘記要這樣開頭… | |
UIGraphicsBeginImageContext(CGSizeMake(320.0, 320.0)); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
defaultCoverImage = [UIGraphicsGetImageFromCurrentImageContext() retain]; | |
UIGraphicsEndImageContext(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DocumentsPath(name) \ | |
[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:name] |