通过点击按钮
答
那是一个非常模糊的问题,从一个视图展现另一种观点......这里是一个开始 - 你可以看看一些语法和研究了一下:
这在viewDidLoad中:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTitle:@"Click" forState:UIControlStateNormal];
[button addTarget:self action:@selector(showView) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
[button release];
,则此方法
- (void)showView {
UIView *view = [[UIView alloc] initWithFrame:CGRect(0,0,320,460)];
[self.view addSubview:view];
[view release];
}
如果你想推一个视图控制器,那么你需要查找导航控制器和方法pushViewController:animated:
答
这是通用代码ü可以使用去下一个视图或去后面,只要改变按钮的名称,其你想按下你想要去的视图名称。例如在后退按钮按u想去库视图,然后编写代码 -
-(IBAction)backButtonPressed:(id) sender
{
libraryView *libraryview=[[libraryView alloc] initWithNibName:nil bundle:nil];
libraryview.modalTransitionStyle=UIModalTransitionStyleCoverVertical;
[self presentModalViewController:libraryview animated:YES];
[libraryview release];
}
让我知道乌尔问题是否得到解决或没有。
您是谷歌吗?或者Atleast是否通过UIViewController类引用?使用“ - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated”in“On button click”action handler – Satyam 2010-09-13 11:24:25