Skip to content

Instantly share code, notes, and snippets.

View mtsd's full-sized avatar

Kosuke Matsuda mtsd

  • Tokyo, Japan
View GitHub Profile
@mtsd
mtsd / gist:1325963
Created October 30, 2011 14:33
install Homebrew and git
########################################################################
# https://github.com/mxcl/homebrew/wiki/Installation
########################################################################
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
$ brew install git
==> Downloading http://git-core.googlecode.com/files/git-1.7.7.4.tar.gz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.7.4 install
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.7.7.4.tar.gz
######################################################################## 100.0%
@mtsd
mtsd / YouTubeCell.h
Created October 31, 2011 04:15
TableViewCellにYouTube動画を表示
#import <Foundation/Foundation.h>
@interface YouTubeCell : UITableViewCell {
// YouTube
UIWebView* youTubeView_;
NSString* youTubeHTML_;
}
@end
@mtsd
mtsd / gist:1350246
Created November 9, 2011 03:29
EXC_BAD_ACCESSの対処法
#
# 毎回忘れるのでメモ
# http://ameblo.jp/tokotokosoftware/entry-10791578218.html
# http://iphone.longearth.net/2009/03/09/【iphone】メモリ不足時のシミュレートとデバッグ/
# http://d.hatena.ne.jp/Kazzz/20120109/p1
# XCode4:「Product -> Edit Scheme」の「Arguments」タブの「Environment Variables」に追加
#
NSDebugEnabled = YES
NSZombieEnabled = YES
@mtsd
mtsd / 1. install MacRuby
Created November 18, 2011 08:38
install and setup CocoaPods
#
# CocoaPods - An Objective-C library dependency manager
# https://github.com/CocoaPods/CocoaPods
#
# sample application
# https://github.com/matsuda/CocoaPodsSample
#
# refs
# http://iphone-dev.g.hatena.ne.jp/laiso/20111117/1321437909
#
@mtsd
mtsd / deviceVersionUtility.h
Last active March 8, 2017 00:26
iOSのバージョン判定
#import <Foundation/Foundation.h>
CGFloat iOSVersion();
BOOL isIOSVersionOver(float v);
BOOL isIOSVersionOver_3_2();
BOOL isIOSVersionOver_5_0();
@mtsd
mtsd / gist:1525728
Created December 28, 2011 01:34
iPhone拡大縮小アニメーション
/*
ScalableViewController.h
*/
@interface ScalableViewController : UIViewController
@property (nonatomic, retain) UIView *scaledView;
@end
/*
ScalableViewController.h
@mtsd
mtsd / gist:1525789
Created December 28, 2011 01:55
タップされたcellのtableView上の位置
- (CGPoint)offsetOfCell:(UITableViewCell *)cell
{
// tableViewがどれだけスクロールされたか
CGPoint offset = self.tableView.contentOffset;
CGPoint point = cell.frame.origin;
point.x -= offset.x;
point.y -= offset.y;
return point;
}
@mtsd
mtsd / gist:1604373
Created January 13, 2012 03:07
ランダムなUIColorを取得
static UIColor * randomColorWithRGB() {
srand(time(NULL));
int rgb = random() % 3;
int code = random() % 10;
UIColor *color;
switch (rgb) {
case 0:
color = [UIColor colorWithRed:0.1 * code green:1.0 blue:1.0 alpha:1.0];
break;
@mtsd
mtsd / gist:1645872
Created January 20, 2012 06:56
xxx-Info.Plistのローカライズ

xxx-Info.Plistのローカライズ

InfoPlist.stringsの追加

  • PROJECT(xxxxx) > info > Localizations > +で[Japanese]を選択。[ja.lproj]フォルダが追加される。
  • Supporting Files > InfoPlist.strings を選択。右クリックから[delete]で[Remove References Only]でリファレンスを解除(ファイルは削除しない)
  • Supporting Filesを選択し、右クリックから[Add Files to "xxx"...]で[en.lproj]と[ja.lproj]を選択してプロジェクトに追加。

アプリ名を日本語表示する場合