如何在另一个视图中按下按钮来调用视图?

时间:2010-11-04 15:49:41

标签: iphone

如何在另一个视图中按下按钮来调用视图?

1 个答案:

答案 0 :(得分:2)

按下按钮的位置:

[myButton addTarget:self action:@selector(clickedButton:) forControlEvents:UIControlEventTouchUpInside];

然后在一个单独的函数中:

-(void)clickedButton:(id)selector {
    // delete as appropriate
    [self.navigationController pushViewController:viewController animated:YES];
    // or
    [self.view addSubview:theView];
    // or
    [self presentModalViewController:viewController animated:YES];
}