Questions tagged [viewwillappear]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
345 views

Is `DispatchQueue.main.async` block in viewWillAppear always called after `viewDidLayoutSubviews`?

I wanted to change the collection view's contentOffset.x right after pushing VC. So I called collectionView.setContentOffset(~) in viewWillAppear. But It didn't work because of auto layout cycle. ...
Nala's user avatar
  • 37
-1 votes
1 answer
258 views

Why screen viewWillAppear is not calling when i back from browser in swift

I am calling my servicecall in viewWillAppear, and in same screen when i click on button webpage is opening in safari browser here when i go back to app from safari then my servicecall is not calling ...
anySwift's user avatar
7 votes
2 answers
729 views

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, ...
user717452's user avatar
0 votes
1 answer
155 views

Variable is nil after assigning value in viewWillAppear

I am new in the async/await in swift and I am trying to assign the job global variable in MyViewController a value using an async function which is then called in the ViewWillAppear. Inside the async ...
keto895's user avatar
0 votes
2 answers
335 views

View will appear is not firing when we dismiss notification settings overlay

I have a view controller when a button clicked I'm taking the user to app settings. UIApplication.openApplicationSettings() When I come back from appsettings to app then viewwillappear method is not ...
D C T's user avatar
  • 39
0 votes
1 answer
510 views

Reload a View after Closing its subView

I have a UIViewController named A, Im adding a another controller to the A controller like this self.AView = (self.storyboard!.instantiateViewController(withIdentifier: "BView") as? ...
Crist's user avatar
  • 39
1 vote
2 answers
1k views

ViewWillAppear is not called when the top-front VC is dismissed

as I wrote in the title, I'm not sure why ViewWillAppear is not called when another VC is dismissed. I think my project is a little bit tricky, so I'm gonna explain what is going on in my project. ...
Yuuu's user avatar
  • 765
0 votes
0 answers
81 views

reloading data/refreshing data in parent ViewController

From a parent VC two other VCs get pushed (first adds a group, second adds some (optional) more data); after popping them the parent VC appears but the new data (new group) is not added. I am using ...
agazaur's user avatar
  • 27
0 votes
1 answer
94 views

how to prevent button showing up for split second when view loads

So my goal is to smoothly load the viewController with no split second bugs. I have a function that is used to determine what buttons to show when the view loads based off a field in a Firestore ...
dsonawave's user avatar
  • 137
3 votes
1 answer
367 views

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 ...
michaeldebo's user avatar
  • 3,085
-1 votes
1 answer
68 views

How to update viewcontroller

I’ve put code in ViewWillAppear and I’ve tried ViewDidAppear but the app only updates when I close it and re-open it. Anyone have any idea on how to fix this? I’m using UserDefaults to update the app ...
Jamesnjones's user avatar
1 vote
2 answers
2k views

Detect when a specific view is opened from the background in SwiftUI?

If I have a SwiftUI view and I put it into the background (i.e. hit the home button once on the iPhone) and then reopen it again, I would like to trigger some action. My first thought was to make use ...
Evan's user avatar
  • 1,952
2 votes
1 answer
48 views

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 ...
Schaedel420's user avatar
0 votes
1 answer
246 views

viewDidLoad vs viewWillAppear vs viewDidAppear parts of this code

I am trying to work on this piece of code from a project I downloaded and trying to use in my code. In the viewDidLoad, a pickerView is populated either by "New Puzzle" or if a user saved a game in ...
midlifecrisis's user avatar
0 votes
1 answer
51 views

Dismissing Pushed view controller without NavigationController

I have two view controllers. VC1 - Displays data in a tableView, selecting one of the cells goes to VC2. VC2 - Show text fields to edit the data. Question - After updating the data and going back ...
CocoLocoSwift's user avatar
0 votes
1 answer
140 views

Correct architecture of iOS ViewController loading async (HealthKit) data

The code below works 90% of the time but every so often I will return an error (i.e. self.hideAllStackViewsAndShowNoWorkoutsMessage() will get called) even though there are workouts to be loaded. I ...
GarySabo's user avatar
  • 6,116
3 votes
2 answers
1k views

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() ...
Noor Ali Butt's user avatar
1 vote
1 answer
931 views

How to fix: UIView animations not restarting when returning to view controller

I have a view that starts animating when a ViewController first opens. It works fine on initial launch, but when returning to the view after leaving the animation does not restart. The views are ...
NPanhuyzen's user avatar
3 votes
1 answer
1k views

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....
amodkanthe's user avatar
  • 4,387
1 vote
1 answer
329 views

Hide navigation bar ios swift life cycle methods not called causing issues

I want to hide navigation bar in a particular view controller in my TabBarController Following is code in my first view controller of tabbar override func viewWillAppear(_ animated: Bool) { ...
amodkanthe's user avatar
  • 4,387
0 votes
0 answers
212 views

willEnterForeground notification but isBeingPresented = false

I'm trying to work out the best way to update a view when the app comes into the foreground. Originally I had assumed that viewWillAppear would do the trick, but it appears I was incorrect. I ...
Ben's user avatar
  • 4,737
0 votes
1 answer
56 views

How can I divide cases in viewWillAppea by Segue?

Purpose I am making App to see a 3D model by Scene kit. Swift 4.0 Xcode 10.1 I want to transfer the image. I create a image in SCNViewController (using SCN View) and after that move to ...
Dan's user avatar
  • 71
-1 votes
1 answer
741 views

UIView Animation and UIButton stop working b/c Home pressed - Swift 4

I have a playButton that performs a "breathing animation". The button works just fine when I press it. The problem occurs if I press the device's Home Button and then re-open the app. Upon re-opening, ...
user avatar
0 votes
1 answer
2k views

Present Interstitial Ad every time the View Controller is presented - Swift 4

I simply want an Interstitial Ad to appear each time a certain View Controller appears. Here's the relevent code (not everything) ... //import ads, set delegate, and declare variable... import UIKit ...
user avatar
0 votes
0 answers
196 views

Delay between viewWillAppear and viewDidLoad after entering foreground

A delay of 2 seconds occurs between viewWillAppear and viewDidAppear only in one screen when application comes back from the background. Normally, there isn't a delay in this screen when the app is ...
D3sT's user avatar
  • 11
0 votes
0 answers
98 views

What is similar to ViewWillAppear of objective-c for React-Native?

I'm using Navigation.startTabBasedApp and for each tab, componentDidMount() only calls one on app start. I want to trigger some method when user taps on particular tab. Even componentWillReceiveProps()...
Hiren Prajapati's user avatar
0 votes
1 answer
112 views

Firebase Storage download not going through in the first run swift

This is the code I use to retrieve image files from Firebase storage: let group = DispatchGroup() print("starting ImageSetting") group.enter() for query in friendArray { if ...
Seongmin Choo's user avatar
42 votes
6 answers
37k views

Swift viewWillAppear not being called after dismissing view controller

I am presenting a view controller from a view controller called HomeController like so: let viewController = self.storyboard?.instantiateViewController(withIdentifier: "LoginController") as! ...
user979331's user avatar
  • 11.3k
0 votes
1 answer
405 views

passing data between viewControllers under a tabController in swift, event sequence

I have a UITabController Main, which has two UIViewControllers, A and B. In storyboard. Each controller has a corresponding swift class, Main, A, B Main.swift is a subclass of UITabController and a ...
julius patta's user avatar
-2 votes
1 answer
106 views

Load CAShapeLayer With UIButton on viewWillAppear Method

I have a custom button with some shadow effect, following class i am using to create a custom button which i got from stackoverflow. It users CAShapeLayer to give effect of shadow on button. import ...
Deepak's user avatar
  • 1,060
0 votes
1 answer
309 views

viewWillAppear called after touch screen

when B -> present -> C, it called viewWillAppear automatic, but after I dismiss from C to B and B -> present -> C again, viewWillAppear called after I touch my screen, which is 1.B -> present -> C, ...
Zoe's user avatar
  • 121
0 votes
2 answers
540 views

How to get location at AppDelegate, and pass the lat and long to another VC and load webview

Edited I have managed to get a current location by using this. After that I am trying to pass lat and long as a string to another method that loads a webview. A problem is every time I load this VC, ...
Hanz Cheah's user avatar
2 votes
3 answers
4k views

How to display the keyboard automatically when a view appears

How can I make the keyboard appearing when a view is displayed?
Blisko 's user avatar
  • 107
-1 votes
1 answer
130 views

Why are interface changes done in viewWillAppear not invisible? [closed]

I have a modal ViewController acting as a custom alert in my app. In it, I have a UIButton title set to some "default text" in Interface Builder. In my viewWillAppear method, I am setting the button ...
Kashif's user avatar
  • 4,460
0 votes
0 answers
333 views

viewWillAppear() stops working after segue and dismiss

The storyboard of my iPhone app starts with a UITabBarController (three icons). From this controller there are three segues to one single UITableViewController (displaying weather data of three ...
Brezentrager's user avatar
0 votes
3 answers
201 views

UINavigationBar title colour

Why doesn't the navigationBar title change its colour to white when I'm back on my main UIViewController? Here is simple code (viewWillAppear, viewWillDisappear), but it doesn't work, the title stays ...
Dejan Malbasic's user avatar
4 votes
0 answers
333 views

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] ...
Octav's user avatar
  • 473
0 votes
2 answers
2k views

unable to find view with tag

In my viewWillAppear() I create a label and give it a tag. When another condition is met, I try to remove the label, but for some reason, that is not working and the label is still in the view. I must ...
erroneous switch's user avatar
0 votes
2 answers
224 views

Can we only configure UI correctly in viewDidAppear? and not in viewWillAppear/viewDidLoad?

I have a static table view with cells that have a rounded border. I have noticed when testing on different simulators that whilst my auto layout constraints work, the border isn't always the right ...
Axemasta's user avatar
  • 763
0 votes
1 answer
44 views

UILabel text size is not getting updated for iPad when the view appears first time

I have a label on my screen which is given marque behaviour. Using size classes I made the label size to a specific size for iPad. When the view appears on screen, the label size is smaller.But, when ...
asd's user avatar
  • 66
0 votes
1 answer
132 views

why will UIViewController viewWillAppear not run after subViews are removed from superView

I am doing a subLayer to a UIViewController like this - (IBAction)transactionListViewCameraBtn_Pressed:(id)sender { if([NWTillHelper isDebug] == 1) { NSLog(@"%s entered", ...
Matt Douhan's user avatar
  • 2,073
0 votes
1 answer
154 views

What happens if I send false to super.viewWillAppear()

Will behaviour of view getting loaded or appearance will change if I send hardcoded false instead of animated to super.viewWillAppear. I tried this code and nothing different happened so I am ...
Nikhil Manapure's user avatar
0 votes
1 answer
608 views

Animating View every time the View Controller appears?

I have a UIViewController that's triggered every time a UITabBarButtonItem is clicked. The problem is that it's sort of a menu, that consists of a UIView that slides from the bottom of the screen up. ...
Dani's user avatar
  • 3,457
1 vote
0 answers
274 views

Swift iOS -How To Check If SelectedSegmentedIndex Is Visible in TabBarController?

I have a tabBarController with 2 tabs. On the 2nd tab, I have a segmentedControl with 2 segments. In the viewWillAppear of both segments, I have code that runs. What I notice is whenever I press the ...
Lance Samaria's user avatar
0 votes
1 answer
340 views

viewDidLoad and viewWillAppear. Download data from server and update tableView

I have an App, it has a database (and a database in a server). When I open the App, it calls a function which gets information from a server and stores the information inside my local database (I'm ...
Daniel C.'s user avatar
  • 151
2 votes
1 answer
1k views

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? [duplicate]

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 ...
Lance Samaria's user avatar
0 votes
1 answer
778 views

Swift - How to refresh NavigationController Menu Bar

Is there a method called, similar to viewwillappear that will refresh the navigationcontroller menu bar at the top of a view?
Jeeves's user avatar
  • 424
1 vote
1 answer
454 views

viewdidappear not called when adding subview to navigation controller

func showCustomViewController(vc : UIViewController,dummy : UIView,fromView1:UIViewController){ datePickerShown = true let fromView = fromView1.navigationController?.view var ...
user2017's user avatar
0 votes
1 answer
790 views

UIPickerView doesn't change color when in viewWillAppear if statement

I am making an app where I have 4 tabs, the last tab is used to change to dark mode (changing the label color, BG color, keyboard color and pickerView color). The func is where I change the color. ...
aleksabaskot's user avatar
2 votes
2 answers
4k views

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 ...
fs_tigre's user avatar
  • 10.8k

1
2 3 4 5 6