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

utility aplication の表裏感でデータのやり取りをしたい場合

http://niconico-iphone.flabo.jp/2011/05/iphone3.html でいけるらしいが・・・。

メソッドの呼び出しの仕方。

クラス名 Mainclassメソッド (void)mesodreiji:(NSInteger)value forKey:(NSString *)defaultName{}他メソッドにて上記のメソッド呼出[Mainclass mesodreiji]objective-c は箱が多すぎ

タイマー動いた。view didloadにNStimerおいてセマフォによって処理でおk

(IBAction)start:(id)sender{ if (countstatus ==1){ countstatus =0;} else { countstatus =1; } } (void)count:(id)sender { if (countstatus ==1){ hyouji= hyouji+0.1;

NStimer + FLIPAction (transition)

画面開始後5秒経つと画面遷移するプログラム完成。(プロジェクト作成時にユーティリティがたを選ぶ) IBAction型をvoidがたに変更してうまくいくのに吉田戦車のいじめてくんを見ながら4時間程度かかった。 (void)viewDidLoad { [super viewDidLoad]; [NSTim…

Nstimer+uialert

viewdidload以下に2秒おきにメッセージが出てくるうざい事この上ないコード書いた。動いた。 (void)viewDidLoad { [super viewDidLoad]; [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(hoge:) userInfo:nil repeats:YES ]; …

数値型から文字型にしてテキストフィールドへ返す

参考元http://gihyo.jp/dev/serial/01/iphone/0005?page=2 (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } (IBAction)executeCalc:(id) sender { [income resignFirstResponder]; [cost resignFi…

alertの中に変数を格納する。これもすぐできた。OJT~C データ型にうるさすぎ

(IBAction)executeCalc:(id) sender { [income resignFirstResponder]; [cost resignFirstResponder]; int str = [income.text intValue]; int str2 = [cost.text intValue]; int str3 = str - str2; [dpi setText:[NSString stringWithFormat:@"%d", str3]]…

alertはとくに苦労せずにかけた。メソッドの中に突っ込んで終わり。

(BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } (IBAction)executeCalc:(id) sender { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"information" message:@"いんふぉめーしょん…

中身のないVOIDすら不要

やはり中身のないVOIDすら不要であったようである。この部分を消しても機能する

さらに計算ボタンを押すとキーボードが隠れるように修正

中身のないvoidをつくり income textfieldとcosttextfield にresignfirstresponder を格納すると 何故かキーボードが隠れるようになる。 #import "fqViewController.h"@implementation fqViewController @synthesize scroll; @synthesize income; @synthesiz…

/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. (void)viewDidLoad { scroll.contentSize = CGSizeMake(320, 1000); [super viewDidLoad]; income.delegate = self; cost.delegate = self; }

/

/* // Implement loadView to create a view hierarchy programmatically, without using a nib. (void)loadView { }

uitextfieldでreturnを押したときにキーボードが引っ込むようにした。 selfだから自身に委譲し、ブール値がイエスになったときにキーボードが引っ込む (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YE…

(IBAction)executeCalc:(id) sender { float str = [income text ]-[cost text]; [dpi setText:[NSString stringWithFormat:@"%@", str]]; } float 型に入力した変数を NSSTringで出力仕様とするとNullになる

iphone アプリ 足し算引き算。

(IBAction)executeCalc:(id) sender { int str = [income.text intValue]; int str2 = [cost.text intValue]; int str3 = str - str2; [dpi setText:[NSString stringWithFormat:@"%d", str3]]; }やっと足し算引き算ができた。オブジェクトCを習い始めて6ヶ…

int のテキスト値のみの出力であれえばsettext できるがintvalue化するとバグる。

(IBAction)executeCalc:(id) sender { int str = [income text]; int str2 = [cost.text intValue]; int str3 = str - str2; [dpi setText:[NSString stringWithFormat:@"%@", str]]; }上記出力ha strなら可能 str2なら不可能

これでも駄目か

(IBAction)executeCalc:(id) sender { float str = [income.text intValue]; float str2 = [cost.text intValue]; float str3 = str - str2; [dpi setText:[NSString stringWithFormat:@"%@", str3]]; }

つかえるかも

■プリミティブ型 プリミティブ型には NSNumber を使う。例えば NSUInteger型 だと、セットするときNSUInteger index = 15; NSNumber *pIndex = [NSNumber numberWithUnsignedInteger:index]; // (1)NSMutableDictionary *dic = [NSMutableDictionary diction…

型式文字列であればうまくゆく

(IBAction)executeCalc:(id) sender { NSString*str = [income text ]; [dpi setText:[NSString stringWithFormat:@"%@", str]]; }stringwithformatは数値は一切受け付けない。 floatのままではダメ、Rubyレベルの柔軟さはない。以下バツ (IBAction)executeC…

変数の表示

(IBAction)executeCalc:(id) sender { NSString *text = @"表示する文字"; [dpi setText:[NSString stringWithFormat:@"%@", text]]; }

/

(void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of t…

/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. (void)viewDidLoad { scroll.contentSize = CGSizeMake(320, 1000); [super viewDidLoad]; } /* // Override to allow orientations other than the defaul…

/

/* // Implement loadView to create a view hierarchy programmatically, without using a nib. (void)loadView { }

/

(void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of t…

/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. (void)viewDidLoad { scroll.contentSize = CGSizeMake(320, 1000); [super viewDidLoad]; } /* // Override to allow orientations other than the defaul…

/

/* // Implement loadView to create a view hierarchy programmatically, without using a nib. (void)loadView { }

UIscrollView

アイフォンアプリを作る。 ユーチューブから拾った。一枚絵のソフトでは画面が足りない。 しかしtableviewではtextfieldを貼り付けることが出来ない。 そんな時のUIscrollview。画面サイズを320*1000とか自由に設定できる。設定がわからない人は こ…

LEGO 8043 インプレッション2

LEGO 8043 の記事をなぜか編集しても反映されないので新エントリー http://www.nicovideo.jp/watch/sm13971072http://www.youtube.com/watch?v=RH9dq1GFa1Iにトラックよじよじが出来るようにした8294をうpした。

メモリリーク解消?

メモリリークについて乱読してみて、C言語ではWHILE文よりもGOTO文のほうが利用するスタックの量が少ないとしているページがあったのでためしてみたらはい正解。カウント210とかも超えて新記録です。 NXCふざけるなよ!!!!!\(^o^)/フザケンナ while(tru…

memory leak対策

メモリリークが起こっていると仮定して、 グローバル変数を使わないとか変数をダイエットしても劇的には改善せず。 一行ごとの計算項目数を減らしてみたり、INT変数を割ったときに端数が出ないように工夫してみたが まるでダメ。sensorからの取得をSensor(S4…