2011-06-01から1ヶ月間の記事一覧

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

参考元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とか自由に設定できる。設定がわからない人は こ…