0
好的,我需要幫助。字符串的數字值
我想喲添加標籤值。 IE瀏覽器。 buttonpLabel = 10,rbuttonLabel = 2
我想我可以以某種方式找到self.buttonfLabel.text的值並將它們添加到self.rbuttonLabel.text。
,我要提供的答案在wLabel
我只是想不通語義.....
任何想法?
Ĵ
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
NSNumber *newValue = [change valueForKey:NSKeyValueChangeNewKey];
NSNumber *supertotals;
// change gives back an NSDictionary of changes
// update the appropriate label
if (keyPath == @"buttonf") {
self.buttonfLabel.text = [newValue stringValue];
}
else if (keyPath == @"rbutton") {
self.rbuttonLabel.text = [newValue stringValue];
}
else if (keyPath == @"pbutton") {
self.pbuttonLabel.text = [newValue stringValue];
}
/////////////below does not work.....
supertotals = [numberWithInt:[bbuttonLabel.text intValue]]+[numberWithInt:[buttonp Label.text intValue]];
self.wLabel.text = [supertotals stringValue];