在弹出框内添加按钮 [英] Adding a button inside a popover

查看:388
本文介绍了在弹出框内添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在Xcode的内部添加一个将用户带到新视图的弹出窗口中的按钮?

Is it possible inside Xcode to add a button inside a popover that will take the user to a new view?

推荐答案

是.

[myPopOver.contentViewController.view addSubview:myButton];
[myButton addTarget:self action:@selector(goToNextView) forControlEvents:UIControlEventTouchUpInside];

- (void)goToNextView
{
 //if you are using xibs use this line
    UIViewController *controller = [[UIViewController alloc] initWithNibName:@"myXib" bundle:[NSBundle mainBundle]];
//if you are using storyboards use this line
    UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"myViewControllersID"];

//to present the controller modally use this
    [self presentViewController:controller animated:YES completion:nil];
//or if you are pushing to this controller using a navigation controller use this
    [self.navigationController pushViewController:controller animated:YES];
}

这篇关于在弹出框内添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆