在IOS 5应用程序上动态加载内容

在IOS 5应用程序上动态加载内容,ios,objective-c,Ios,Objective C,我是IOS开发新手,需要在应用程序首次启动时动态加载内容(按钮)。有人能帮我指引方向吗?我参加了培训,但不幸的是我没有学会。我在ViewController中已经有了一个方法,但如何在加载时执行该方法 感谢您的帮助。以下是您可能会发现有用的教程: 这是一个由两部分组成的教程,演示如何以编程方式添加内容 下面是一个例子: // create a button object UIButton *button = [UIButton buttonWithType:UIButtonTypeRounde

我是IOS开发新手,需要在应用程序首次启动时动态加载内容(按钮)。有人能帮我指引方向吗?我参加了培训,但不幸的是我没有学会。我在ViewController中已经有了一个方法,但如何在加载时执行该方法


感谢您的帮助。

以下是您可能会发现有用的教程:

这是一个由两部分组成的教程,演示如何以编程方式添加内容

下面是一个例子:

// create a button object
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];    

// attach a method 'buttonPressed' when the button is pressed.
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchDown]; 

// set the text shown on the button
[button setTitle:@"buttonTitle" forState:UIControlStateNormal]; 

// set the size of the button
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); 

// add the button to your view
[view addSubview:button]; 

您可以使用ViewDidLoad-它是一个委托方法,在ViewController的视图加载时自动调用,您可以在那里进行自定义加载。这非常完美。它给了我一些方向。非常感谢。