Skip to content

Instantly share code, notes, and snippets.

View motoishmz's full-sized avatar

Motoi Shimizu motoishmz

View GitHub Profile
#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
#define RGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_RETINA [[UIScreen mainScreen] scale] > 1.0
#define LANGUAGE ([NSLocale preferredLanguages][0])
#define SCREEN_BOUNDS ([UIScreen mainScreen].bounds)
@motoishmz
motoishmz / resize_ios_app_icons
Last active December 17, 2015 17:19
original.png = 1,024 x 1,024 png image
/*!
// cite: http://m.designbits.jp/12101514/
// Icon
Icon.png 57 x 57 for non-retina iPhone/iPod touch (3/3G/3GS)
Icon@2x.png 114 x 114 for retina iPhone/iPod touch
Icon-72.png 72 x 72 for non-retina iPad
Icon-72@2x.png 144 x 144 for retina iPad
Icon-Small.png 29 x 29 for non-retina iPhone/iPod touch Spotlight and Settings (optional)
Icon-Small@2x.png 58 x 58 for retina iPhone/iPod touch Spotlight and Settings (optional)
@implementation SomeUtils
static NSString * const kPlistName = @"MySettings";
static NSString * const kExtention = @"plist";
+ (NSDictionary*) launchSetting
{
NSString* path = [[NSBundle mainBundle] pathForResource:kPlistName ofType:kExtention];
NSDictionary* plist = [NSDictionary dictionaryWithContentsOfFile:path];
@implementation MyView
- (id)init
{
self = [super init];
if (self)
{
UINib *nib = [UINib nibWithNibName:@"SettingView" bundle:nil];
UIView *settingView = [[nib instantiateWithOwner:self options:nil] objectAtIndex:0];
@implementation Test
static Test *singleton_ = nil;
+ (Test*)singleton
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
static NSString * const kPlistName = @"ZeroCameraSettings";
static NSString * const kExtention = @"plist";
/*!
plist utils
*/
+ (NSMutableDictionary*)getPlist
- (id)init{
self = [super init];
if (self)
{
self.frame = CGRectMake(0, 0, 100, 100);
self.backgroundColor = [UIColor clearColor];
self.opaque = NO;
}
int main(int argc, char *argv[])
{
@try {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MyAppDelegate class]));
}
}
@catch (NSException *exception) {
NSLog(@"%@", exception.callStackSymbols);
}
- (UIImage *)resize:(UIImage *)src
{
UIImage *newImage;
CGFloat width = 0.0;
CGFloat height = 0.0;
if (src.size.width > SCREEN_BOUNDS.size.width)
{
width = SCREEN_BOUNDS.size.width;
#include "ofMain.h"
class ofApp : public ofBaseApp
{
public:
void setup();
void update();
void draw();
void keyPressed(int key);