我在项目中动态创建了5个按钮 现在,当我点击一个按钮时,我希望每个动态按钮的代码移动到下一个屏幕 如果您的示例示例与我的要求相同,请在此处发布。
我知道拖放控制很容易连接下一个表单,但我想动态地这样做 我到目前为止的代码:
for (i = 1; i <= 5; i++) {
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
aButton.frame = CGRectMake(xCoord, yCoord, buttonWidth, buttonHeight);
[
aButton addTarget:self action:@selector(whatever:)
forControlEvents:UIControlEventTouchUpInside
];
[scrollView addSubview:aButton];
yCoord += buttonHeight + buffer;
}
答案 0 :(得分:2)
请参阅此答案:Push another View in UINavigationController?
请参阅此答案以使用Nibs:Navigation Controller Push View Controller
UIViewController *viewController = [[UIViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];