草庐IT

UiviewController

全部标签

ios - 关闭推送的 View Controller

所以我有一个显示如下的ViewController:funcshowProfileForTrainer(trainer:Trainers){letviewPTProfileVC=ViewPTProfileVC()viewPTProfileVC.trainer=trainerself.navigationController?.pushViewController(viewPTProfileVC,animated:true)}但是当试图关闭View时,我无法让它工作。它在导航栏中有一个后退按钮,功能正常,但是当试图通过按钮关闭View时,它什么都不做。我目前尝试过:funchandleM

ios - 使用 xib 实例化 ViewController 时的帧大小不正确

我有一个看起来像这样的ViewController:classSpotViewController:UIViewController{letspot:Spotinit(spot:Spot){self.spot=spotsuper.init(nibName:"SpotViewController",bundle:nil)}overridefuncviewWillAppear(animated:Bool){super.viewWillAppear(animated)print("viewWillAppear:\(view.frame)")#=>(0.0,0.0,600.0,600.0)}o

ios - 在预设演示之前丢失对 transitioningDelegate 的引用

在Xcodebeta2和iOS10beta2之前,我有一个可用的自定义UIPresentationController。我没有更改任何代码,但演示文稿现在以标准模式演示文稿呈现。在UIPresentationController的Apple示例代码中有一条说明:Forpresentationswhichwilluseacustompresentationcontroller,itispossibleforthatpresentationcontrollertoalsobethetransitioningDelegate.Thisavoidsintroducinganotherobjec

ios - 如何实现交互式单元格滑动以触发过渡动画,如 WhatsApp

我正在寻找如何像WhatsApp单元格滑动一样实现,我已经使用UIPanGestureRecognizer实现了单元格滑动动画,唯一剩下的就是执行交互式动画-添加新的UIViewController到窗口并根据手势识别速度和X轴值-显示。一些额外的注释以准确说明我想要实现的目标:我有一个UITableViewController,其中包含自定义的UITableViewCell。我希望能够从左向右拖动一个单元格以启动交互式动画。(注意:我已经实现了单元格滑动)。新的UIViewController将从左向右推送。滑动单元格时,UITableViewController的View将向右移动

uitableview - "Use of unresolved identifier"与 swift

我正在用Swift重写我的一个应用程序,它显示南科哈拉的实时天气数据。到目前为止喜欢swift!我有一个小问题阻碍了一切。我有一个基于标签栏的应用程序,仅限iPad。我的其中一个选项卡是一个UIViewController,在Storyboard中添加了一个TableView以显示NOAA预报。我有一个数据类Data,它从我们的服务器检索列表并在viewDidLoad中创建常量List。它是一个数组数组,每个子数组中有四个字符串。我已经验证它在那里,因为我可以创建一个常量:List[0]和println所有字符串。但是,当我使用它来填充TableView时,出现“使用未解析的标识符”错

swift - 如何从 UIAlertController 的 UIAlertAction 处理程序中关闭 UIViewController?

我想向用户展示一个简单的UIAlertController,其中一个选项会触发父ViewController的关闭。这是我正在使用的代码:letalert=UIAlertController(title:title,message:message,preferredStyle:UIAlertControllerStyle.Alert)alert.addAction(UIAlertAction(title:"CloseView",style:UIAlertActionStyle.Destructive,handler:{actioninself.dismissViewController

ios - "Warning: Attempt to present * on * which is already presenting *"的断点

有时它会发生-从代码的不同地方-我们想要做UIViewController.presentViewController(a,b,c),有时我们已经在呈现了,在这种情况下我们得到:警告:尝试在已经呈现*的*上呈现*是否有可能打破这个警告?如何为此设置断点? 最佳答案 首先,您需要将符号断点设置为-[UIViewControllerpresentViewController:animated:completion:]。您可以通过Xcode的AddSymbolicBreakpoint功能轻松添加它。其次,您需要设置一个条件,以便仅当Vie

ios - 强制 iOS View 不旋转,同时仍允许 subview 旋转

我有一个带有subviewController的ViewController。tabbarcontroller||navcontroller||UIPageViewController(shouldrotate)||A(VideoPlayer)(shouldn'trotate)||B(Controlsoverlay)(shouldrotate)应强制A始终保持纵向,但应允许B自由旋转。我知道shouldAutorotate适用于任何ViewController及其subview,但是有什么办法可以解决这个问题吗?似乎我可以使用shouldAutorotateToInterfaceOri

swift - 如何在 Swift 中显示来自另一个类的警报?

我有一个主类AddFriendsController,它运行以下代码行:ErrorReporting.showMessage("Error",msg:"Couldnotaddstudenttostorage.")然后我有了这个ErrorReporting.swift文件:导入基金会classErrorReporting{funcshowMessage(title:String,msg:String){letalert=UIAlertController(title:title,message:msg,preferredStyle:UIAlertControllerStyle.Alert

ios - AdMob Interstital 显示时导航栏移动

当我显示插页式广告时,状态栏逐渐消失,导航栏向上移动。导航栏下所有内容上移。当我关闭广告时,一切都会向下移动。它看起来非常奇怪和故障。我在Storyboard中使用NavigationController并启用了ShowNavigationBar属性。在AppDelegate.m文件中显示插页式广告的代码:[self.interstitialAdpresentFromRootViewController:self.window.rootViewController];基本上,当我展示插页式广告时,我需要所有东西都留在原地不动。 最佳答案