Skip to content

Instantly share code, notes, and snippets.

View is8r's full-sized avatar
🙂

Yu Ishihara is8r

🙂
View GitHub Profile
//時間を算出
NSDate* now = [NSDate date];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"HH"];
int hour = [[dateFormatter stringFromDate:now] intValue];
[dateFormatter setDateFormat:@"mm"];
int min = [[dateFormatter stringFromDate:now] intValue];
[dateFormatter setDateFormat:@"s"];
int sec = [[dateFormatter stringFromDate:now] intValue];
NSLog(@"%i:%i:%i",hour,min,sec);
//時間を算出
NSDate* now = [NSDate date];
int hour = [[now dateWithCalendarFormat:nil timeZone:nil] hourOfDay];
int min = [[now dateWithCalendarFormat:nil timeZone:nil] minuteOfHour];
int sec = [[now dateWithCalendarFormat:nil timeZone:nil] secondOfMinute];
NSLog(@"%i:%i:%i",hour,min,sec);
//facebook
-(NSNumber *) facebook:(NSString*)s
{
if(!facebookState) facebookState = [[NSNumber alloc] initWithInt:0];
if(s == @"logout") {//ログアウトの場合
[_facebook logout:self];
facebookState = [[NSNumber alloc] initWithInt:0];
return facebookState;
}
//
// AppDelegate.h
// untitled
//
#import <UIKit/UIKit.h>
#import "FBConnect.h"
//facebook
#define kFBAppId @"xxxxx" //REPLACE ME
static inline void HOLink(NSString *url)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
NSURL *url = [NSURL URLWithString:@"http://google.co.jp"];
[[UIApplication sharedApplication] openURL:url];
- (void) initScrollLayer
{
int pageMax = 3;//ページ数
CGSize s = [[CCDirector sharedDirector] winSize];
//ScrollLayer
scroll = [ScrollLayer node];
[scroll changeContentWidth:s.width*pageMax];
[self addChild:scroll];
//Label
CCLabel* l0 = [CCLabel labelWithString:@"PAGE01"
//TTFをロード
[[FontManager sharedManager] loadFont:@"kroe0556.ttf"];
//ラベルを設置
CCLabel* label = [CCLabel labelWithString:@"FONT LOADED" fontName:@"kroe0556.ttf" fontSize:8];
CGSize size = [[CCDirector sharedDirector] winSize];
label.position = ccp( size.width/2 , size.height/2 );
[self addChild: label];
#import "Calendar.h"
NSMutableArray *mList = [[Calendar instance] create:2009 month:10];
NSLog(@"10月12日は [%@]", [[mList objectAtIndex:11] objectForKey:@"h"]);
NSMutableArray *mList = [[Calendar instance] create:2009 month:10];
NSString* s;
switch ([[[mList objectAtIndex:0] objectForKey:@"w"] intValue])
{
case 1:
s = @"月";
break;
case 2:
s = @"火";
break;