草庐IT

NewViewController

全部标签

ios - 通过 topviewcontroller 在自定义类上设置委托(delegate)的简洁方法

我已经定义了一个类NewViewController,它显示了一个用于在应用程序中添加新项目的屏幕,该项目被包装在UINavigationController中。我想在这个UIViewController上设置一个delegate,我目前在prepareForSegue方法中这样做:UINavigationController*navController=segue.destinationViewController;NewViewController*newViewController=(NewViewController*)navController.topViewControll

ios - 将目标添加到另一个 View Controller 中的按钮

为什么这行不通?我希望新ViewController中的closeBtn调用当前ViewController中名为dismiss:的方法。NewViewController*newVC=[[NewViewControlleralloc]initWithNibName:@"NewViewController"bundle:[NSBundlemainBundle]];[newVC.closeBtnaddTarget:selfaction:@selector(dismiss:)forControlEvents:UIControlEventTouchUpInside];dismiss:方法从不

iphone - 将 UIViewController 传递给另一个 ViewController 中的另一个 Button

我有三个这样的按钮,每个按钮对应一个不同的UIViewController:例如,我按下按钮1。它会将与它将显示的数字对应的ViewController传递给开始按钮。我需要能够在这个按钮中传递它:这可能吗? 最佳答案 是的,只需将UIButton创建为按钮点击时显示的ViewController上的属性。然后,在按钮点击的处理程序中,在显示新Controller之前使用新Controller上的按钮属性分配按钮。示例代码://here'syourmethodinvokedwhenpressingthebutton1-(IBActi

iphone - UIViewController - UIModalPresentationCurrentContext 不旋转 presentingViewController

我曾经使用呈现样式UIModalPresentationCurrentContext从另一个UIViewController呈现一个UIViewController。但它不允许我旋转presentingviewcontroller(呈现新UIViewController的UIViewController)self.modalPresentationStyle=UIModalPresentationCurrentContext;NewViewController*newViewController=[[NewViewControlleralloc]initWithNibName:@"Ne

ios - 如何以编程方式从 UIVIew 呈现 View Controller

我使用的类是MessageView(SwiftMessageLibrary)的子类,继承自UIView。在里面,我有一个UIButton,我想通过它以编程方式呈现另一个ViewController。下面是我的代码:importFoundationimportSwiftMessagesimportUIKitclassMyClass:MessageView{varhideBanner:(()->Void)?@IBActionfunchelpButtonPressed(_sender:UIButton){letstoryBoard:UIStoryboard=UIStoryboard(name

ios - 在容器 View Controller 中添加/删除时如何为 subview Controller 设置动画?

我有以下2个函数可以添加和删除从容器ViewController触发的subviewController:@discardableResultfuncaddChildViewController(withChildViewControllerchildViewController:UIViewController)->UIViewController{//AddChildViewControlleraddChildViewController(childViewController)childViewController.beginAppearanceTransition(true,a

ios - 在容器 View Controller 中添加/删除时如何为 subview Controller 设置动画?

我有以下2个函数可以添加和删除从容器ViewController触发的subviewController:@discardableResultfuncaddChildViewController(withChildViewControllerchildViewController:UIViewController)->UIViewController{//AddChildViewControlleraddChildViewController(childViewController)childViewController.beginAppearanceTransition(true,a

iphone - newViewController 始终带有两个 Nib (iPhone 和 iPad)

为通用应用程序xibs定制xcode,这样当我创建一个像VideoVC的新ViewController时,它必须为此创建两个nib文件,视频VC_iPhoneVideoVC_iPad谁能帮帮我。没有指导方针。只是步骤。谢谢 最佳答案 您将在“/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode”中看到模板文件夹在这里您将看到文件和项目模板,您可以根据需要编辑或创建新模板。针对您的问题,导航到此文件夹