开发者

How to make a view by clicking a Button on iPhone programmatically?

开发者 https://www.devze.com 2022-12-21 08:52 出处:网络
I have developed a program with UIButtons with a navigationBar, now I do not know how to get a view by clicking a Button. When I click the button it should show me a different view. I also want to kno

I have developed a program with UIButtons with a navigationBar, now I do not know how to get a view by clicking a Button. When I click the button it should show me a different view. I also want to know after passing to the view, how to navigat开发者_JS百科e back to the before view programmatically?


You want pushViewController:animated: and popViewControllerAnimated:.

Take a look at the UINavigationController documentation.


Also u also develop something like this,

CGRect cg = CGRectMake(130.0, 220.0, 100.0, 30.0);
    UIButton *btn = [[UIButton alloc] initWithFrame:cg];
    btn.showsTouchWhenHighlighted = YES;
    btn.backgroundColor = [UIColor blueColor];
    [btn addTarget:self action:@selector(Showlbl:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

And give the proper button event in above part,

action:@selector(Showlbl:) 
0

精彩评论

暂无评论...
验证码 换一张
取 消