Delay between viewWillAppear and viewDidLoad after entering foreground
up vote
0
down vote
favorite
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 active. In debugging, it seems both viewWillAppear and viewDidAppear are completed in a few milliseconds.
In the screen, there is a horizontal scrollview of 9 pages and in each one, there is a tableview. I realized that the delay disappears when the below code of tableviews' reload is removed from viewWillAppear.
for i in 0 ..< self.levelTables.count {
self.levelTables[i].tableView.reloadData()
}
I don't understand why this causes delay. When the app is active, there is no delay. It only appears when the application comes from the background. What's the difference? If it takes time, why is this delay not occurring always?
Any ideas?
swift tableview delay viewwillappear viewdidappear
add a comment |
up vote
0
down vote
favorite
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 active. In debugging, it seems both viewWillAppear and viewDidAppear are completed in a few milliseconds.
In the screen, there is a horizontal scrollview of 9 pages and in each one, there is a tableview. I realized that the delay disappears when the below code of tableviews' reload is removed from viewWillAppear.
for i in 0 ..< self.levelTables.count {
self.levelTables[i].tableView.reloadData()
}
I don't understand why this causes delay. When the app is active, there is no delay. It only appears when the application comes from the background. What's the difference? If it takes time, why is this delay not occurring always?
Any ideas?
swift tableview delay viewwillappear viewdidappear
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
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 active. In debugging, it seems both viewWillAppear and viewDidAppear are completed in a few milliseconds.
In the screen, there is a horizontal scrollview of 9 pages and in each one, there is a tableview. I realized that the delay disappears when the below code of tableviews' reload is removed from viewWillAppear.
for i in 0 ..< self.levelTables.count {
self.levelTables[i].tableView.reloadData()
}
I don't understand why this causes delay. When the app is active, there is no delay. It only appears when the application comes from the background. What's the difference? If it takes time, why is this delay not occurring always?
Any ideas?
swift tableview delay viewwillappear viewdidappear
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 active. In debugging, it seems both viewWillAppear and viewDidAppear are completed in a few milliseconds.
In the screen, there is a horizontal scrollview of 9 pages and in each one, there is a tableview. I realized that the delay disappears when the below code of tableviews' reload is removed from viewWillAppear.
for i in 0 ..< self.levelTables.count {
self.levelTables[i].tableView.reloadData()
}
I don't understand why this causes delay. When the app is active, there is no delay. It only appears when the application comes from the background. What's the difference? If it takes time, why is this delay not occurring always?
Any ideas?
swift tableview delay viewwillappear viewdidappear
swift tableview delay viewwillappear viewdidappear
asked Nov 10 at 18:21
D3sT
67
67
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40
add a comment |
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242054%2fdelay-between-viewwillappear-and-viewdidload-after-entering-foreground%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How many tables do you have? Also, you should try using Instruments for profiling, it should help you find which function is causing the freeze.
– Guy Kogus
Nov 10 at 19:25
I have 9 tables and I realized that reloading causes freeze. But why only when coming back from the background? Also, I tried putting reloading into DispatchGroup.main.async but it didn’t work. :(
– D3sT
Nov 10 at 19:34
The reloading itself shouldn't take too long, assuming your views aren't doing anything that they shouldn't. Find what's blocking your main thread using Instruments. If you need to learn how start here: raywenderlich.com/…
– Guy Kogus
Nov 10 at 19:36
Thank you very much. I've checked but I didn't get useful info. It points "main" with a self weight of 1.18s. When double click, it refers to "class AppDelegate: UIResponder, UIApplicationDelegate" line.
– D3sT
Nov 10 at 20:40