草庐IT

UiviewController

全部标签

ios - 在 View Controller 转换中获取 subview 的最终帧

我正在iOS7+中实现ViewController之间的自定义转换。特别是,我在ViewControllerA和ViewControllerB中有相同的按钮,唯一的区别在于它的位置(它在ViewControllerB中稍微高一点)。我希望在从ViewControllerA到ViewControllerB的转换中,A中的按钮向上移动,以便它在ViewControllerB中的最终位置结束。这是我的animateTransition:方法:-(void)animateTransition:(id)transitionContext{UIViewController*fromViewCont

ios - 将 GLKView 嵌套到 UIViewController 中

我正在尝试在UIViewController中使用GLKView,我的代码如下所示CustomViewController.h#import#import@interfaceCustomViewController:UIViewController{NSString*name;}@propertyNSString*name;CustomViewController.m#import"CustomViewController.h"@interfaceCustomViewController()@end@implementationCustomViewController@synthesi

ios - 继续 : destination view controller weirdness

在我的应用程序中,我使用Storyboard和转场,我经常在转场之前将数据传递到目标ViewController,如下所示:-(void)prepareForSegue:(UIStoryboardSegue*)seguesender:(id)sender{if([segue.destinationViewControllerrespondsToSelector:@selector(setMyData:)]){[segue.destinationViewControllerperformSelector:@selector(setMyData:)withObject:myData];}}

ios - 如何通过代码从 SKScene 转到 UIViewController?

如果当用户触摸skscene中的skspritenode时,它​​会转到不同的View,如performseguewithidentifier。谢谢你的帮助。我可以发布代码,但这似乎是一个通用问题,所以我认为您不需要任何代码。顺便说一句,我已经想出了如何检测skspritenode的敲击。我已经看了很长时间了,我很难过。请帮忙。 最佳答案 您不能从SKScene中呈现viewController,因为它实际上只在SKView上呈现。您需要一种方法来向SKView的viewController发送消息,后者将呈现viewControl

ios - 我应该在 App Store 上发布一个带有打印声明的应用程序吗?

我打算尽快(在TestFlight之后)将我的应用发布到AppStore。我有很多ViewController,其中包含print语句。print语句用于测试目的(调试器),用户永远不会看到它们。如果我在发布应用程序后在应用程序中包含或不包含打印语句,会有什么不同吗?打印语句是否会降低场景之间切换的速度,即使是几毫秒?我会因为将它们包含在我的应用中而被拒绝吗?在几个vc中,为了清楚起见,我打印了uid。在应用程序中包含这些打印报表是否存在任何安全风险? 最佳答案 我假设您使用的是Swift,那么print是完全安全的,即使对于App

ios - 具有大标题跳转的后退按钮动画

我们有两个UIViewController和一个UINavigationController。在viewWillAppear(_animated:Bool)中的第一个VC中,我们做:overridefuncviewWillAppear(_animated:Bool){super.viewWillAppear(animated)if#available(iOS11.0,*){navigationController?.navigationBar.prefersLargeTitles=truenavigationController?.navigationItem.largeTitleDi

iphone - 什么时候为自定义 subview 子类化 UIViewController?

我已经看到自定义subview作为UIViewController子类实现,但也许可以作为UIView子类实现。我什么时候应该为subview继承UIViewController而不是UIView?子类化UIViewController有什么缺点吗? 最佳答案 就个人而言,当我需要一些重要的逻辑继续时,我会使用UIViewController子类来完成。此外,如果我正在寻找您从UIViewController获得的一些行为,例如以模态方式或在导航Controller中呈现它。如果您正在做一些相当简单或轻量级的事情,UIView子类通

ios - UIViewController 的子类不捕获触摸事件

我有一个父类(A),它是UIViewController。比我创建的类B是类A的子类。发生的事情是我无法使用诸如touchesBegan之类的方法捕获类B中的触摸事件。但是如果我在类A中实现这个方法......它们会被调用。@interfaceA:UIViewController.....@interfaceB:A 最佳答案 要使用UIViewController,必须执行如下事件:-(void)touchesBegan:(NSSet*)toucheswithEvent:(UIEvent*)event{UITouch*touch;C

objective-c - 以编程方式在委托(delegate)中调用 Storyboard

我正在尝试以编程方式调用我的Storyboard。我的Storyboard包括以下内容:[导航Controller]->[MainMenuView]->[DetailsView]“MainMenu”标识符被放置在[MainMenuView]中我遇到的问题是屏幕显示空白。我需要做什么?谢谢。-(BOOL)application:(UIApplication*)applicationdidFinishLaunchingWithOptions:(NSDictionary*)launchOptions{UIStoryboard*storyboard=[UIStoryboardstoryboar

ios - 如何获取 rootviewcontroller ios Storyboard

我在Storyboard的RootView中有一个菜单表,我想在subview更新数据时重新加载它。如何获取对RootView的引用,以便我可以对其调用reloaddata方法? 最佳答案 如果rootViewController是UIViewController,您可以使用下面的代码访问它UIViewController*rootController=(UIViewController*)((AppDelegate*)[[UIApplicationsharedApplication]delegate]).window.rootVi