在xcode NSLog中的第二个视图控制器中加载数据 [英] Loading data in second view controller in xcode NSLog

查看:204
本文介绍了在xcode NSLog中的第二个视图控制器中加载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是对象C和iphone应用程序开发的新手。

I am quite new to object C and iphone app development.

以下是我所拥有的:
StoryBoard

我做了什么


  1. 将按钮拖动到第一个视图控制器。

  2. 拖动第二个视图控制器。

  3. 添加推送动画

  4. 编辑>>嵌入>>导航控制器

  1. Dragged button to first view controller.
  2. Dragged second view controller.
  3. Added push animation
  4. 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中的第二个视图控制器中加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆