Showing hidden view really slow
@MobileMon told you how to fix your problem, but not why.
The UIKit is not thread-safe, meaning that must make all UIKit calls from the main thread. Setting a view's hidden flag is a UIKit call, so it needs to be done from the main thread.
If you manipulate UIView objects from a background thread results are undefined. Most of the time the result is that it takes a long time for the change to take effect (what you are seeing), but sometimes the change doesn't happen at all, sometimes the result is bizarre visual effects, and sometimes your app will crash.
Whenever you manipulate a UIView object from a background thread, you need to wrap it in a call to dispatch_async(dispatch_get_main_queue())
as in MobileMon's answer (Or some other approach that causes the code to be run from the main thread, but this is the preferred way.)
Edit:
To be clear, you say:
The problem I'm running into, is that from a worker thread I'm calling
WKExteralLoader.externView!.hidden = false;
WKExteralLoader.webView!.hidden = true;
You can't do UI code from a worker thread. Instead you need to write that code like this:
dispatch_async(dispatch_get_main_queue(), ^{
WKExteralLoader.externView!.hidden = false;
WKExteralLoader.webView!.hidden = true;
});
That way, from your worker thread you dispatch your UI code back to the main thread.
You may have other code that's trying to do UIKit calls from a background thread when you're not aware of it. To check, add the following line:
print("isMainThread = \(Thread.current.isMainThread)")
And then check to see what's printing in the console.
Extremely slow performance of hide/show function when dealing with large number of elements
Ok, I do apologize for this, but this is mind blowing....
After solid 50 JS tweaks with no avail, it turns out that my problem was in CSS!!!
After wasting a day on this, turns out that "background-size: 100%;" crashes webkit! That's insane... Removing that one line removed all of my crashes.
Again, very sorry for reporting the wrong issue.
hide/show are *very* slow
In firefox to show/hide a table row you have to set the follwoing.
//To show
$("tr").css("display", "table-row");
//To hide
$("tr").css("display", "none");
Jquery hide() and show() runs too slow in google chrome
Looks like this has nothing to do with jQuery and just is a problem with Chrome hiding an parent element that has a HUGE number of children elements.
This just uses basic javascript to hide the element on document ready:
document.getElementById('sortable-lines').style.display="none";
And it still takes forever after the document is ready.
http://jsfiddle.net/petersendidit/UZCZc/10/embedded/result/
Opened a Chrome bug for this: http://code.google.com/p/chromium/issues/detail?id=71305
Related Topics
How to Convert a Persian Date into a Gregorian in Swift
Save Video to a Custom Album Using Photos Framework in iOS
Retrieving Uiimage from Uiimageview in Swift
How to Update a Sent Message in Quickblox iOS
The Array Value Should Be Sort Like (Alphabetic, Numbers and Special Characters)
Can't Dismiss Navigation Controller in Swift
Getting Uitableview Error "Unable to Dequeue a Cell with Identifier Cell"
Animate a Change in Part of an Nsmutableattributedstring
How to Design an Uiscrollview in Storyboard
Why Is This Array Out of Index
Updating Label Takes Too Long (Swift)
Get the Exact Difference Between 2 Dates for a Single Nsdatecomponent
How to Go Back to Rootviewcontroller from Presentview Controller
How to Insert a Override Function into a If Else Statement
Generate a Hmac Swift Sdk8.3 Using Cchmac()
How to Use Alamofires Servertrustpolicy.Disableevaluation in Swift 3