Questions tagged [viewwillappear]

UIViewController instance method that notifies the view controller that its view is about to be added to a view hierarchy.

View controller subclasses typically override viewWillAppear to perform any tasks to customize the display of the view, based on the context in which the view is being displayed, as described in the documentation.

292 questions
5
votes
0 answers

tvOS searchController viewWillAppear not being called when navigating back

So I followed the instructions for the recommended way of adding a search view controller. Basically let resultsController = storyboard.instantiateViewControllerWithIdentifier(SearchResultsViewController.storyboardIdentifier) as?…
5
votes
2 answers

When to put into viewWillAppear and when to put into viewDidLoad?

I get used to put either of viewWillAppear and viewDidLoad, it's OK until know. However I'm thinking there should be some rules that guide when to put into viewWillAppear and when to put into viewDidLoad?
LiangWang
  • 8,038
  • 8
  • 41
  • 54
5
votes
1 answer

Different subview layouts in viewDidLoad and viewWillAppear

Possible Duplicate: UIViewController returns invalid frame? While debugging i've noticed that in viewDidLoad call my view frame is origin=(x=0, y=20) size=(width=320, height=460) which is not accurate. In viewWillAppear call it is set up…
peetonn
  • 2,942
  • 4
  • 32
  • 49
4
votes
2 answers

iOS - Loop through Cells and retrieve data

Sorry I'm pretty new to iOS dev. I have a UITableView setup from cells being pulled from a single XiB nib. I've created a on/off switch in the nib, and I am trying to save the state of the switch upon viewWillDisappear for the number of cells that I…
Romes
  • 3,088
  • 5
  • 37
  • 52
4
votes
0 answers

Changing the key window does not call view will/did dis/appear

When I change the key window, the rootViewController(s) do not receive view will/did appear/disappear. SplashViewController *screenLockViewController = [[SplashViewController alloc] initWithNibName:@"SplashViewController" bundle:nil]; …
4
votes
1 answer

Changing NSLayoutContraint constant in viewDidLoad or viewWillAppear don't works

I am trying to do something like this: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; NSLog(@"%@", self.tableViewHeight); self.tableViewHeight.constant = 0; NSLog(@"%@", self.tableViewHeight); …
k06a
  • 17,755
  • 10
  • 70
  • 110
4
votes
1 answer

viewwillappear and viewdidappear not called

this question is very frequent, but I am not able to solve it with any answers available. I am working on iOS 5.1. My navigation controller is one tab amongst tab bar view controllers. There's a tableview, in which selecting of a row pushes new view…
4
votes
3 answers

Wrong value for statusBarOrientation on viewWillAppear

I need to change the image background of a View depending on the orientation. For this, I am using the statusBarOrientation approach in viewWillAppear: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; …
MRD
  • 7,146
  • 1
  • 21
  • 21
3
votes
2 answers

viewWillAppear and UIApplicationDidBecomeActiveNotification

I am using the UIApplicationDidBecomeActiveNotification to refresh my tableview when the app becomes active. My problem is that in my ViewWillAppear, I am also calling a method to refresh this table's data. This is causing the table to be refreshed…
edhnb
  • 2,122
  • 3
  • 24
  • 38
3
votes
2 answers

iOS 5.0 view life-cycle issue

I'm facing strange behaviour of my custom view controller subclasses on iOS 5.0. I'm not using standart navigation controllers etc. in my iPad application, but I'm presenting all view controllers myself - this is why I needed to call -viewWillAppear…
user999445
  • 31
  • 3
3
votes
1 answer

viewWillAppear not called apparently due to my view hierarchy

This appears to be a well documented problem, yet the solutions online have not worked. Here's just a sample list of posts that failed to provide me with a working answer: ViewWillAppear not executing code viewWillAppear not getting…
michaeldebo
  • 3,065
  • 4
  • 14
  • 20
3
votes
2 answers

iOS 13 In Tab Bar child view controller viewWillAppear is not called

I have a tab bar controller and I have added five view controllers in it like this: class InfluencerMainTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() let findWorkVC =…
3
votes
1 answer

present ViewController calling viewWillDisappear but does not call viewWillAppear

Following is my code present safari view controller if let url = URL(string: "https://www.ggogle.com.com/") { let config = SFSafariViewController.Configuration() config.entersReaderIfAvailable = true let vc =…
3
votes
2 answers

How to stop viewWillAppear from completing until a function has finished

I'm pretty new to IOS Application Development. I'm trying to stop viewWillAppear from finishing until after my function has finished working. How do I do that? Here's viewWillAppear: override func viewWillAppear(animated: Bool) { …
Alex
  • 141
  • 2
  • 10
3
votes
1 answer

viewWillAppear equivalent in background mode

The workflow of my app is when I lost connection I redirect the app to a specific viewController, then on the viewWillAppear I do some treatment. In the foreground mode this works perfectly. In the background mode, the redirection is performed, but…
raed
  • 4,887
  • 4
  • 30
  • 49
1 2
3
19 20