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
11
votes
4 answers

Android SDK equivlent for viewWillAppear (iOS)?

Situation I have a fairly simple app with 2 "layouts" using SharedPreferences. Main.xml Settings.xml Main has a textView that uses getString from SharedPreferences. Also a button to open Settings. Settings has a spinner and a button to save to…
10
votes
2 answers

In IOS 4.x or lower, viewDidAppear method is not getting called while adding subview to a view, why?

In iOS 4.x or lower, viewDidAppear and viewWillAppear, viewDidDisappear and viewWillDisappear, such ViewController's delegate methods are not getting called. The same methods work fine with the iOS 5.x. Why? Is it a bug in iOS 4.x or lower. Because…
Mrunal
  • 13,982
  • 6
  • 52
  • 96
10
votes
4 answers

viewWillAppear in viewcontrollers of a tabbar

In my tab-bar I have four viewcontrollers, and what happens in one can affect the view of the other, so I may need to reload some elements in the viewcontroller when it becomes visible. Normally I'd fix that by implementing viewWillAppear, but when…
9
votes
2 answers

ViewWillAppear on UITableViewCell?

Is there any way to perform something like ViewWillAppear on UITableViewCell? UITableViewDelegate methods (like willDisplayCell) only works when cells appear by scrolling. In my situation, I need to detect cell appearance in a situation like user…
Bigair
  • 1,452
  • 3
  • 15
  • 42
9
votes
7 answers

iOS routing viewDidAppear to child view controllers?

I'm adding a child view controller to a parent view controller, and everything works as expected, except that child view controller isn't having its usual callbacks triggered. eg, things like viewWillAppear(animated) is never called. I looked into…
pachun
  • 926
  • 2
  • 10
  • 26
9
votes
2 answers

When exactly should I call [super viewWillAppear:] and when not?

I have always thought that calling [super viewWillAppear:animated] is mandatory. But today I came across a piece of code from Apple's example application called CoreDataBooks and here's viewWillAppear: implementation from there: -…
Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
7
votes
2 answers

UIStackView on TitleView Spacing issue after iOS 16

I have an UIStackView set up on the title view of the navigation bar in my app. It simply shows the icon of the app to the left of the title. In iOS 15 and earlier, this displayed fine. Right now, however, it shows fine the first time you launch the…
7
votes
5 answers

Problems with UINavigationController inside of UITabBarController, viewWillAppear not called

As an overview, I'm having issues with a UINavigationController inside of a UITabBarController calling viewWillAppear whenever a view is popped from the stack. From the delegate, a UITabBarController is made programmatically: // Create views for…
Dandy
  • 1,203
  • 1
  • 16
  • 31
7
votes
3 answers

iPad viewWillAppear and presentModalViewController problems

In the iPhone, I have a tableview, and touching the cells, I have one method calling presentModalViewController, and opening another view, with email and this kind of stuff. When the user press the cancel button, the viewWillAppear method in the…
Wak
  • 71
  • 3
6
votes
2 answers

iOS 9 changed view load behaviour

I have noticed a change in how iOS 9 loads/displays views compared to previous versions of iOS. Here's an output of self.view.frame in iOS 8.4 viewDidLoad {{0, 0}, {320, 504}} viewWillAppear {{0, 64}, {320, 504}} viewDidAppear {{0, 64}, {320,…
artooras
  • 6,315
  • 9
  • 45
  • 78
6
votes
3 answers

Determine viewWillAppear from Popped UINavigationController or UITabBarController

I am unable to find a way to distinguish between popping from the Nav controller stack and entering the view controller from the UITabBarController. I want to call a method in ViewWillAppear only when the view is presented from the TabBar, not when…
DogCoffee
  • 19,820
  • 10
  • 87
  • 120
6
votes
5 answers

About viewController's "viewDidLoad" and "viewWillAppear" methods

I've got a question regarding the two mentioned methods, since in my tests I don´t make clear the order they are called. I thought that, firstly, viewDidLoad is called when the viewController is loaded for first time (as the name indicates), and…
AppsDev
  • 12,319
  • 23
  • 93
  • 186
5
votes
3 answers

popViewController / viewWillAppear not animated in iOS 5

I wasn't lucky with searching for this, so here we go ;) I have a UIViewController with a custom UINavigationBar which pushes another UIViewController as subview. Everything works fine except when I click the back button on the subview. The previews…
Hannes
  • 3,752
  • 2
  • 37
  • 47
5
votes
2 answers

Determine the first time a UIViewController appears

Before resorting to custom flags I wanted to check this with you people. Is there a built-in way to determine in viewWillAppear: or viewWillDisappear: whether the UIViewController is 'newly pushed' onto a UINavigationController's stack, or whether…
epologee
  • 11,229
  • 11
  • 68
  • 104
5
votes
2 answers

ViewDidAppear/ViewWillAppear not being called

I have a ViewController that adds to other subviews which have subclassed uiviewControllers so Its like this: mainViewController | v---------v subVC1 subVC2 And neither subVC1 or subVC2 have the viewDidAppear/viewWillAppear fired on…
Jonathan.
  • 53,997
  • 54
  • 186
  • 290
1
2
3
19 20