uiviewcontroller

Observer for monitoring when view controllers' viewDidAppear have been executed

末鹿安然 提交于 2019-12-24 05:42:43
问题 Summary of question UINavigationControllerDelegate:didShowViewContoller makes it possible to get notified whenever any view controller has been displayed (as opposed to being loaded), provided its within the context of a navigation stack. I want to know if such observation is possible for all view controllers if there isn't a navigation stack. More background I have an app where view controllers can suddenly appear based upon timers and local notifications firing, thus their appearance is

iOS Swift popToViewController by Name

别等时光非礼了梦想. 提交于 2019-12-24 05:41:14
问题 I'm trying to pop to a viewcontroller which I believe is at index 0. My ViewController name is HomeVC. self.navigationController!.popToViewController(self.navigationController!.viewControllers[0] as! UIViewController, animated: true) However, the code above only pops me back to the most recent viewcontroller. Not sure why it's not going to my HomeVC viewcontroller. Is their a way I can use the ViewController Name to pop to it? 回答1: Try this: for (var i = 0; i < self.navigationController?

How do I prepare a UIViewController's view for being added to a UIStackView?

久未见 提交于 2019-12-24 05:38:11
问题 This is what I'm trying to do... I have one view controller that needs to dynamically display different subviews based on the presence of some data. Here is a simple mockup. Each colored block represents a unique subview . Sometimes the green block needs to be at the top, sometimes the green block won't display at all, sometimes the light blue block will be something different, etc. Each subview has interactive elements, so I've been creating and adding them like so: Defining a new view

UIView animation continues to run after a new view controller is pushed onto the stack

天大地大妈咪最大 提交于 2019-12-24 02:52:43
问题 Solved. Ridiculously embarrassing. I wasn't using an instance variable, I declared it outside of curly braces in the implementation. Really struggling. I have a view controller that manages an animated countdown timer. The animation is using recursive UIView animation and a simple int ivar that gets decremented. Something like the following (this is a simplified snippet): - (void) animate { [UIView animateWithDuration:0.75f delay:0.25f options:UIViewAnimationCurveEaseInOut animations:^{ aView

with “viewDidLoad” my viewController take much time to appear!

二次信任 提交于 2019-12-24 01:25:13
问题 when i load my viewController i used "viewDidLoad"method to init my view ,but this take much time to make the view appeared .So i had the idea to use "viewDidAppear" method to accelerate the appearance of my view but the load of the informations about my view are now loaded to the memory every time that i push my view (which is normal) or i pop to it(and there is my problem) Have you an idea? 回答1: Create a background task that is started in viewDidLoad and just updates the GUI when it's

Swift SpriteKit: Best practice to access UIViewController in GameScene [closed]

痞子三分冷 提交于 2019-12-24 01:19:58
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . I wanted to see what the best practice(s) of accessing UIViewController methods from GameScene is/are. Right now I have been using NSNotificationCenter, but I don't want to use this due to specific functionality that I am trying to achieve. Also, if there are not any other

ios swift 3 - UIAlertController width

老子叫甜甜 提交于 2019-12-24 01:16:23
问题 Is there anyway to create a custom alertController that fit the width of the screen ? I tried several things before asking this question one of them is : let width:NSLayoutConstraint = NSLayoutConstraint(item: alertController.view, attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, toItem: nil, attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: view.bounds.width ) alertController.view.addConstraint(width) But this line of code always makes a horizontal

UIViewController resizing itself between viewWillAppear and viewDidAppear?

本小妞迷上赌 提交于 2019-12-24 00:55:17
问题 I've got a really strange bug in my project. I've got a UIScrollView as my main, big view. Inside of it, I have a UIViewController (not UITableViewController ) which has a UITableView instance variable, as well as some miscellaneous UIButtons . I have set the view controller's view frame to CGRectMake(0, 64, 320, 388) , as I have a tab bar above it (this is not functional yet). At first it works great and looks great, but once I present and dismiss a modalViewController (thus reloading the

Does it make a difference where to put [super viewDidLoad] in my UIViewController? [duplicate]

早过忘川 提交于 2019-12-24 00:44:11
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: [super viewDidLoad] convention Does it make a difference where I put [super viewDidLoad] within the viewDidLoad in my UIViewController? I.e., should it go at the beginning (before my code to set up the UIViewController) or the end )after my code to set up the UIViewController) of the method, or does it not make any difference? 回答1: You should usually call super as early as possible. Otherwise, the superclass may

No visible interface for dismissModalViewControllerAnimated:completion

我是研究僧i 提交于 2019-12-24 00:35:42
问题 I have a UIViewController derived class which uses the method dismissModalViewControllerAnimated:(BOOL) , like this: [self dismissModalViewControllerAnimated:YES]; Since the compiler complains with a warning saying that this method is deprecated, I have changed it to the suggested replacement, dismissModalViewControllerAnimated:completion: , like this: [self dismissModalViewControllerAnimated:YES completion:nil]; But now, a get an error in that line of code saying "No visible @interface for