Skip to content

Instantly share code, notes, and snippets.

View urouro's full-sized avatar

Kenta Nakai urouro

View GitHub Profile
@urouro
urouro / gist:4147647
Created November 26, 2012 11:02
ファイルサイズなどの取得
NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:[url path] error:nil];
NSLog(@"File Attributes=%@", attr);
/*
ex)
File Attributes={
NSFileCreationDate = "2012-11-26 10:24:39 +0000";
NSFileExtensionHidden = 0;
NSFileGroupOwnerAccountID = 501;
NSFileGroupOwnerAccountName = mobile;
@urouro
urouro / gist:4239883
Created December 8, 2012 11:20
[Template]application:didFinishLaunchingWithOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
TopController *controller = [[TopController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
[nav setNavigationBarHidden:NO];
self.window.rootViewController = nav;
[controller release];
[nav release];
@urouro
urouro / gist:4239894
Created December 8, 2012 11:22
NSLog Macro
#ifdef DEBUG
#define LOG(fmt, ...) NSLog((@"[%@] " fmt), NSStringFromSelector(_cmd), ##__VA_ARGS__);
#define LOG_PRINT(fmt, ...) NSLog((@"%s " fmt), __func__, ##__VA_ARGS__);
#define LOG_METHOD NSLog(@"%@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
#else
#define LOG(...);
#define LOG_METHOD;
#define LOG_PRINT(...);
#endif
@urouro
urouro / gist:4324431
Created December 18, 2012 02:17
Delegate
//MyObject.h
@interface NSObject (<# class #>Delegate)
- (void)<# classname #>DidFinish:(<# class #> *)controller;
@end
//MyObject.m
- (void)onCloseButton:(UIButton *)button
{
@urouro
urouro / gist:4461232
Last active December 10, 2015 16:29
UITableView DataSource Required
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if(!cell){
<# controller #> *controller = [[[<# controller #> alloc] init] autorelease];
controller.delegate = self;
UINavigationController* navController;
navController = [[UINavigationController alloc] initWithRootViewController:controller];
navController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:navController animated:YES];
@urouro
urouro / gist:4493124
Last active December 10, 2015 21:08
Androidをコマンドラインで開発するときのメモ
# Android SDKを落として
# ↓にパスを通す
# hogehoge/android-sdk-macosx/platform-tools
# hogehoge/android-sdk-macosx/tools
#
# <editor> ~/.bash_profile
# PATH = PATH:上のパス
# プロジェクトを作成
@urouro
urouro / gist:4517920
Created January 12, 2013 12:38
UITextFieldの自動補完を切る
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
textField.autocorrectionType = UITextAutocorrectionTypeNo;
@urouro
urouro / gist:5371443
Created April 12, 2013 11:44
iOS カメラロールへ保存
UIImageWriteToSavedPhotosAlbum(image, self, nil, nil);
@urouro
urouro / gist:6483237
Last active December 22, 2015 14:08
Push通知送信
function sendPushNotification()
{
$deviceToken = '<64桁のデバイストークン>';
// Push通知で表示するメッセージ
$alert = 'Push通知を送信しました';
// Push通知受け取り時、アイコンに表示するバッジの数字
$badge = 1;