问题描述
我是对象C和iphone应用程序开发的新手。
I am quite new to object C and iphone app development.
以下是我所拥有的:
StoryBoard
我做了什么
- 将按钮拖动到第一个视图控制器。
- 拖动第二个视图控制器。
- 添加推送动画
- 编辑>>嵌入>>导航控制器
- Dragged button to first view controller.
- Dragged second view controller.
- Added push animation
- Editor >> Embed in >> Navigation controller
这是我的代码:
现在我添加了一类目标C,类名为NSObject的dResult子类。
Now i added, a class of objective C, class with name dResult subclass of NSObject.
我的问题是
我想在类dResult中放置一个函数viewDidLoad ,然后在第二个视图控制器加载一旦有人点击显示下一个时执行它。
I want to place a function viewDidLoad within class dResult, and then execute it when second view controller loads once someone click on "show next".
推荐答案
如果我明白你想要什么,你想在第二个视图控制器的viewDidLoad方法中做这样的事情:
If I understand what you want, you want to do something like this in the second view controller's viewDidLoad method:
-(void)viewDidLoad {
[super viewDidLoad];
dResult *dResultObject = [[dResult alloc] init];
[deResultObject someMethodIHaveInDResult];
}
其中someMethodIHaveInDResult是你在dResult类中实现的方法。目前还不清楚dResult类中的函数viewDidLoad是什么意思 - dResult不是一个视图控制器,所以它没有viewDidLoad方法,我会在那里调用一个方法,因为它会让人困惑。
Where someMethodIHaveInDResult is a method the you've implemented in the dResult class. It's not clear what you mean by "function viewDidLoad within class dResult" -- dResult isn't a view controller, so it doesn't have a viewDidLoad method, and I would make a method in there called that, because it would be confusing.
这篇关于在xcode NSLog中的第二个视图控制器中加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!