Questions tagged [viewwillappear]
UIViewController instance method that notifies the view controller that its view is about to be added to a view hierarchy.
292
questions
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.
...
-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 ...
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, ...
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 ...
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 ...
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? ...
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.
...
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 ...
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 ...
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 ...
-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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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()
...
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 ...
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....
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) {
...
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 ...
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 ...
-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, ...
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
...
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 ...
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()...
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 ...
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! ...
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 ...
-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 ...
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, ...
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, ...
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?
-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 ...
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 ...
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 ...
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] ...
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 ...
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 ...
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 ...
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", ...
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 ...
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.
...
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 ...
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 ...
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 ...
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?
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 ...
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. ...
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 ...