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
2
votes
3 answers

view will disappear is not firing

i am using addSubView method to add views. Did any alternative methods are there for viewWillDisappear? viewWillDisappear is not firing. I want to release all allocated objects when the current view get dissapear. Currently i am using dealloc method…
Vipin Vijay
  • 393
  • 5
  • 21
2
votes
1 answer

- (void)viewWillAppear:(BOOL)animated detect custom animation

I have a button which when pressed pushes a view controller however i'm using a custom animation so pushViewController: childController animated: is set to NO. What i want to do though is detect this custom animation in my -…
Sami
  • 1,374
  • 1
  • 16
  • 43
2
votes
1 answer

Swift NavigationBar Press "Back" to get values, why?

I am using some values to perform some calculations. For testing purposes I show in Label1 a value as string, since it is stored as a string and in Label2 I show a casted value as a Double since I need them at the end as doubles for my…
2
votes
1 answer

UIViewController resizing itself between viewWillAppear and viewDidAppear?

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…
aopsfan
  • 2,451
  • 19
  • 30
2
votes
3 answers

How to display the keyboard automatically when a view appears

How can I make the keyboard appearing when a view is displayed?
Blisko
  • 107
  • 2
  • 9
2
votes
1 answer

Swift iOS -In ViewWIllAppear How to Check If ImagePicker is Being Presented or Dismissed While Switching Tabs or The View Is Being Pushed On/Off?

I have a tabBarController and in one of the tabs is a view named view2. In view2 have some code that runs in viewWillAppear. I also have an UIImagePickerController in view2. fileprivate var imagePicker = UIImagePickerController() override func…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
2
votes
2 answers

Why showing and hiding view from viewWillAppear or viewDidAppear doesn't work

I recently converted an app from modal viewControllers to TabBarController and there is some code that used to work fine before the conversion but now I'm having a hard time making it work in the TabBar app. What I want to do is update the UIin a…
fs_tigre
  • 10,650
  • 13
  • 73
  • 146
2
votes
2 answers

viewDidAppear being called strangley

I have a viewController containing segmentedControl. I have a VCA and VCB which are in the segmentedControl. When I tap on second segment VCB appears. Now I am pushing another ViewController from VCB. But when coming back from that viewController,…
2
votes
4 answers

viewDidAppear called twice, but viewWillAppear called once

I have discovered that when my program starts, in one of my viewcontrollers the order of calling is viewDidAppear, viewWillAppear, viewDidAppear. I was not expecting the first viewDidAppear to be called. What could be causing this and how do I fix…
John Smith
  • 12,491
  • 18
  • 65
  • 111
2
votes
2 answers

ViewDidAppear and ViewWillAppear is being called multiple times on one viewDidLoad in ios swift app

I am making iPhone app on swift,here ViewDidAppear and ViewWillAppear is being called multiple times on one viewDidLoad in ios swift app? please help me.
sulabh qg
  • 1,155
  • 2
  • 12
  • 20
2
votes
2 answers

View Controller loads before data is pulled from firebase login - Swift

I am having trouble getting data to load correctly in my ViewDidAppear method when using a Firebase login. I want the user to press the login button, the app to retrieve the user's information from Firebase, and then display it in the next view…
Eric Duffett
  • 1,654
  • 17
  • 25
2
votes
2 answers

viewWillAppear not called after popToViewController

I have a little problem. I am working on a simple application with Views Controllers in a Navigation Controller like this: A->B->C (-> are modal segues) View A is the Root View Controller and I need to come back to A from C. If I call the method…
2
votes
4 answers

EXC_BAD_ACCESS error at viewwillappear using scrollToRowAtIndexPath

I'm getting an EXC_BAD_ACCESS error when using scrollToRowAtIndexPath in the viewWillAppear method. I searched for solutions and saw some old posts recommending to set delegate and table to nil (see code below), however when I set that I simply dont…
Kitcc
  • 2,138
  • 4
  • 24
  • 42
2
votes
5 answers

Why viewWillDisappear or viewDidDisappear not called when app quit in iOS simulator?

I'm trying to call removeObserver() when the app quits. But when I used NSLog() to check, I found neither viewWillDisappear() nor viewDidDisappear() was called after the app quit in iOS simulator. I'm using a single view template, not navigation…
Zhu Shengqi
  • 3,632
  • 3
  • 24
  • 29
2
votes
1 answer

iOS viewWillAppear Error: "view is not in the window hierarchy"

I have a Swift application, and what I'd like to do is that every time the app becomes active, I'd like to check for a user in session. If not found, I'd like to show a login view controller that I designed in my Storyboard. If found, I need…
John Doe
  • 1,005
  • 2
  • 8
  • 23