uiviewcontroller

How can I completely reload a view so that viewDidLoad gets run again?

不羁的心 提交于 2019-12-22 06:28:22
问题 I would like to reload my view so that viewDidLoad redoes all of its work. How can I do that in Swift? 回答1: viewViewDidLoad and viewWillAppear are part of the view controller lifecycle and are called automatically by iOS after your UIViewController got instantiated and before the view appears on the screen. You can call them anywhere in your view controller class, but that's not at all good practice and I would never recommend you to do so! If you have code that you want to be executed at

How to disable auto-rotation for specific View Controllers inside a Navigation Controller (Swift)? [duplicate]

心不动则不痛 提交于 2019-12-22 05:59:54
问题 This question already has answers here : locking orientation does not work on ipad ios 8 swift xcode 6.2 (5 answers) Closed 4 years ago . ^Above does not have answer at all...Having issues disabling auto rotation for specific (not all) View Controllers that are inside a navigation controller. Similar questions do not address the ability to disable autorotation for specific view controllers but rather to disable autorotation in all of the view controllers inside of a navigation controller. My

Dismiss and present modal view controller with one animation

狂风中的少年 提交于 2019-12-22 05:59:47
问题 The problem is that I don't know how to dismiss and present a view controller with only one transition animation. My storyboard structure is: We can say that A controller is what follows the NavigationController, B is the Startup reference and C is the TabBar ViewController. Both B and C are presented modally with a Cross Dissolve transition. When a user logins into the app (from B ), C controller is presented modally with a Flip horizontal transition. And when a user logouts (from C ), B is

Issue with Modal View Controllers and definesPresentationContext

我是研究僧i 提交于 2019-12-22 05:49:13
问题 I've created a custom container view controller using the new UIViewController container view controller methods in iOS 5. Trouble is, even though my container controller's child UIViewController has definesPresentationContext = YES, when it creates and presents another modal view controller, UIKit sets the container (rather than the child) as the presenting controller. For example, in MyChildViewController.m: - (void)showMailComposeView:(id)sender { __block MFMailComposeViewController *vc =

How to get the current displaying UIViewController not in AppDelegate?

杀马特。学长 韩版系。学妹 提交于 2019-12-22 05:35:56
问题 I'm trying to get the currently display UIViewController that is not in the AppDelegate, but it seems to always get the initial top UIViewController , and not the present one. The following code in AppDelegate DOES get the current UIViewController present, but this same function does not work when I use it in any one of my View Controllers: func getTopViewController() -> UIViewController { var topViewController = UIApplication.sharedApplication().delegate!.window!!.rootViewController! while

UISplitViewController Cannot Change the Master View Controller?

雨燕双飞 提交于 2019-12-22 05:14:44
问题 I am trying to change the master view controller (that appears in the popover in portrait, and on the left side in landscape) in a UISplitViewController. I'd like to switch between the master view controller being one of two different UIViewControllers (depending on an action taken elsewhere in my application). I am using the following: mySplitViewController.viewControllers = [NSArray arrayWithObjects:newMasterController, detailController, nil]; This correctly changes the master

Get final frames of subviews while in a view controller transition

纵饮孤独 提交于 2019-12-22 04:57:07
问题 I'm implementing a custom transition between view controllers in iOS 7+. In particular, I have the same button in view controller A and view controller B, the only difference is in its position (it's a little bit higher in view controller B). I want that in the transition from view controller A to view controller B the button from A moves up so that it ends in the final position in view controller B. Here's my animateTransition: method: - (void)animateTransition:(id

UIViewController & UIview dealloc not getting called

混江龙づ霸主 提交于 2019-12-22 04:42:54
问题 I have a Navigation based view controller and in the view controller i have hidden the top navigation bar and use a custom UIView as the navigation bar. The UIView bar has a back button and I use Delegate methods(I have declared a protocol) to communicate to the view controller when the back button is preesed. I use delegate in my CustomNavigation Bar id delegate; and In the main View Controller when i allocate the navigation bar i set the delegate topBar = [[TopNavigationBar alloc]

How do I animate child view controllers when adding to/removing from a container view controller?

孤街浪徒 提交于 2019-12-22 04:36:26
问题 I have the following 2 functions that add and remove child view controllers triggered from a container view controller: @discardableResult func addChildViewController(withChildViewController childViewController: UIViewController) -> UIViewController { // Add Child View Controller addChildViewController(childViewController) childViewController.beginAppearanceTransition(true, animated: true) // Add Child View as Subview view.addSubview(childViewController.view) // Configure Child View

How to resize UINavigationController in a storyboard editor

雨燕双飞 提交于 2019-12-22 04:15:18
问题 When I want resize an UIViewController in a storyboard editor window I do: I put size to "freeForm" in the UIViewController attributes inspector I select the view and resize her with the size inspector after that, the uiViewController is resized in storyboard window. Next, I select the view controller, click on: edit > embeded in> Navigation Controller and the problem is that navigation controller is in full size and not the same size that UIViewController. I don't find how resize this