2013-02-08 116 views
0

我是xcode的新手。我有一個文本字段的形式,在這種形式中,我只能輸入數字。 我如何從這個文本字段獲取信息到我的標籤?如何從textfield獲取信息?

+0

你能舉一個你正在談論的代碼的例子嗎? – 2013-02-08 23:12:30

回答

0

我想你正在開發iOS? [label setText:textField.text];應該這樣做。

0
@implementation WorktimerViewController{ 
NSTimer *timer; 
int MainInt; 
int zarabotal; 
int stavka; } 

@synthesize price; 
@synthesize donebutton; 
@synthesize lave; 




- (void)updateLabels 
{ 
self.lave.text = [NSString stringWithFormat:@"%d", zarabotal]; 

} 
- (void) countup 
{ 
MainInt += 1; 
_second.text = [NSString stringWithFormat:@"%i", MainInt]; 


} 

- (void)StartTimer{ 
MainInt = 1; 
timer = [ NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countup) userInfo:nil repeats:YES]; 
zarabotal = stavka/MainInt; 
[self updateLabels]; 

}