2013-02-08 56 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]; 

}