JMD*_*JMD 1 iphone xcode objective-c ipad ios
我只使用xcode中的故事板,但我的新老板希望每个人都在xib文件中完成,其中我没有经验.
到目前为止我所做的就是创建了一个新的单视图应用程序,并在'viewDidLoad'方法下添加了代码..
UILabel *scoreLabel = [ [UILabel alloc ] initWithFrame:CGRectMake(0, 0.0, 150.0, 43.0) ];
[self addSubview:scoreLabel];
Run Code Online (Sandbox Code Playgroud)
和线
[self addSubview:scoreLabel];
Run Code Online (Sandbox Code Playgroud)
抛出错误'No Visible @Interface for'ViewController'声明选择器'addSubView'
我到底错过了什么?
self是一个UIViewController.您将子视图添加到UIView.所有你需要的是:
[self.view addSubview:scoreLabel];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4771 次 |
| 最近记录: |