Deca-pod.jp

Anything

2014-01-01から1年間の記事一覧

UIButtonを使って画面遷移をする。

まずボタンを作成する。 //ボタンが押されるとpushAlertメソッドを呼び出す。 SEL method = @selector(pushAlert); UIButton * button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(20, 20, 40, 15); [button setTitle:…

Ruby on rails 開発環境を構築する

Xcode,CommandLineToolsがインストールされているものとします。 ターミナルを立ち上げて ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)” を実行します。 passwordの入力を求められるのでpassを入力してenter 上手く行けば I…

if (somePerson != nil)って?

スカラ変数は宣言時に初期化するのがよい習慣です。そうでないと、スタック領域にたまたま残って いた「ごみ」の値になってしまいます。 BOOL answer =NO; int magicnumber = 10; オブジェクトを指すポインタについては、これは必要ありません。初期値を指定…

@propertyで構造体を扱う方法

クラスTestを新しく作成して@interface部に typedef struct{ int a,b,c; }character; と宣言をして更に @property character player; を宣言しました。 他のクラスからTest *test= [Test new];をして test.player.a = 10;とするとエラー これは内部的にtest.…

typedef enumでproperty拡張

//.hファイルに typedef enum{ morning; afternoon; night; }env; @properrty env dayCondition; とすると self.dayCondition = morning; というようにアクセスすることができる。 このまま定数を使う予定のmファイルに#importしても定数を使えますが、 面倒…

objective-cでRPGの戦闘ダメージ計算

#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self paramSet2:100 str:10 vit:…

Viewcontrollerにcustomclassが設定できない!

iphoneアプリ作りを始めたらまずやるのがとりあえずViewcontrollerもう一個作って画面遷移をしてみよう!ってやつ。 元からあるのをViewcontroller新しく作った画面をViewcontrollerSubとしよう。Viewcontrollerからcontrol押しながらViewcontrollerSubへ引…

View ControllerでScene is unreachable ..とエラーが出た時の解決方法。

Scene is unreachable due to lack of entry points and does not have an identifier for runtimeaccess via -instantiateViewControllerWithIdentifierScene is unreachable due to lack of entry points and does not have an identifier for runtimeacce…