Recent projects related to AppleWatch, but there is a strange problem cannot be solved, and can not understand:
Depending on the user action, the player's album image needs to be modified.
I don't know if it has anything to do with my project needs: Do I need to poll the space to get the sync data, is it a performance issue? I don't know
The method I have tried is as follows:
1. The Wkinterfaceimage inheritance relationship is nsobject,:-> Wkinterfaceobject, There is no way to use UIView to remove a picture and add a new picture (Addsubview,removefromsuperview)
2. No corresponding forced Refresh method such as Setneeddisplay
3. Only the Sethidden method depends on the dot spectrum, but it still fails after the attempt
4. I try to replace it with two different pictures, and call the Sethidden method, still invalid
5. The problem with StackOverflow is similar:there are wkinterfaceimage in the cell in the wkinterfacetable, and when reusing the old cell, it is found that the old picture content has not been replaced. The answer is: This is a bug, has been resolved in xcode6.2 (my God, my 6.3.2, but still not resolved AH), the temporary solution is: Before assigning a new picture content, first assign nil.
[Self.image Setimagenamed:nil]; // can also be an empty string [Self.image setimagenamed:@ "XXXX"];
But I am still invalid here.
6. The final solution is to use the GCD delay method to execute the relevant code when the image needs to be updated. But I don't know if it's due to the inefficient synchronization between watch and iphone???
Dispatch_after (Dispatch_time (Dispatch_time_now, (int64_t) (0.1 * nsec_per_sec)), Dispatch_get_main_queue () , ^{});
In addition: Legend Wkinterfacedevice can store the cache, and can be assigned to the image object by the key value, but unfortunately, I here once found that there are pictures in the cache, and then assign the value of the time, the picture can not be updated, it is very strange .... You are welcome to discuss together.
Wkinterfaceimage Unable to update picture problems