【发布时间】:2013-03-08 10:47:30
【问题描述】:
我遇到了 xcode 的问题。 我是 object-c 和 xcode 的菜鸟,所以......请帮忙。
我有 2 个视图控制器:ViewController (with .m/.h) 和 HighScores (with .m/.h).
在 HighScores 中,我放置了一个名为 first 的标签。在ViewController 中,我有一个名为*textField 的UITextField。我希望 textField 中的文本在我输入文本时出现在标签中,并且当已经玩过的游戏得分高于标签中已经存在的文本(“第一”)时。
所以,
这就是我的 HighScore.h 的样子:
#import <UIKit/UIKit.h>
@interface HighScores: UIViewController {
IBOutlet UILabel *first;
}
@end
这是 ViewController.m:
#import "ViewController.h"
#import "HighScore.h"
...
NSString *myString = [HighScores.first];
if (score.text > myString) {
NSString *string = [textField text];
[HighScores.first setText:string]
但是 xcode 说当我在点 '.' 之后键入“first”时出现错误...如果我希望 xCode 识别来自 HighScore UIViewController in VewController @ 的“first”标签,我该如何做到这一点987654329@?
谢谢!
【问题讨论】:
标签: xcode uiviewcontroller uilabel textfield