You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my project, each cell represents a specific URL. In this particular case, I make an API call to figure out what the URL represents, and re-layout the cell based on the new information I receive. It's very similar in concept to ASDKgram and how it fetches the comments specific to a post, and re-layouts the cell upon receiving.
It works great 90% of the time, but every so often, if I put a breakpoint at my setNeedsLayout call (once the cell has found out what it represents), and another at my overridden layoutSpecThatFits method, I see that the latter is never called, and I'm not sure why given that most of the time it acts as I would expect.
In the cell's init, I perform the network call, and in its completion handler I create the new node (important to note perhaps that this is the first time this node is created; it's nil prior to this as the node instantiated is dependent on what the API returns). I then call setNeedsLayout immediately, and then layoutSpecThatFits should pick up on the fact it's not nil and then include it in the node hierarchy.
If I log these calls, it looks like this when it works as expected:
In the example project below, you can see by restarting the app a few times, that normally, the network call is received, the cell performs another layout pass, and the cell shows the new information. However, if you restart it enough (sometimes takes 5+, and is much easier to replicate on a device rather than the simulator), you'll see it won't show the image after the API call returns:
I'm really at wit's end trying to figure out what may be causing it. It should already be in the view hierarchy at the time it's called so it's not as if setNeedsLayout is being called on a non-visible node. It's totally possible (even likely) that it's something I'm doing accidentally to cause this, but any light anyone could shine onto the issue would be greatly appreciated.
Sample project: TextureTest.zip
(Just run pod install; uses most recent version of Texture. There's some other files inside that are part of the model and for API calls, but really the only relevant files are LargePostCellNode and PostsViewController. It may take a few restarts of the app to show the issue.)
The text was updated successfully, but these errors were encountered:
In my project, each cell represents a specific URL. In this particular case, I make an API call to figure out what the URL represents, and re-layout the cell based on the new information I receive. It's very similar in concept to
ASDKgram
and how it fetches the comments specific to a post, and re-layouts the cell upon receiving.It works great 90% of the time, but every so often, if I put a breakpoint at my
setNeedsLayout
call (once the cell has found out what it represents), and another at my overriddenlayoutSpecThatFits
method, I see that the latter is never called, and I'm not sure why given that most of the time it acts as I would expect.In the cell's
init
, I perform the network call, and in its completion handler I create the new node (important to note perhaps that this is the first time this node is created; it'snil
prior to this as the node instantiated is dependent on what the API returns). I then callsetNeedsLayout
immediately, and thenlayoutSpecThatFits
should pick up on the fact it's not nil and then include it in the node hierarchy.If I log these calls, it looks like this when it works as expected:
and when not:
In the example project below, you can see by restarting the app a few times, that normally, the network call is received, the cell performs another layout pass, and the cell shows the new information. However, if you restart it enough (sometimes takes 5+, and is much easier to replicate on a device rather than the simulator), you'll see it won't show the image after the API call returns:
I'm really at wit's end trying to figure out what may be causing it. It should already be in the view hierarchy at the time it's called so it's not as if
setNeedsLayout
is being called on a non-visible node. It's totally possible (even likely) that it's something I'm doing accidentally to cause this, but any light anyone could shine onto the issue would be greatly appreciated.Sample project:
TextureTest.zip
(Just run
pod install
; uses most recent version of Texture. There's some other files inside that are part of the model and for API calls, but really the only relevant files areLargePostCellNode
andPostsViewController
. It may take a few restarts of the app to show the issue.)The text was updated successfully, but these errors were encountered: