1

How can I create lots of UIView & setting text on the UITextView which is the subview of UIView in Background thread.

Currently I am using a for loop to create the UIView but it is blocking the user to do anything.

Please help me to get this done. Thanks In Advance :)

DAMM108
  • 970
  • 2
  • 13
  • 27

2 Answers2

2

UIKit is not intended to be used in background. You do not need to have lots and lots of instantiated UIViews, as they would consume a lot of resources, but as many as you can show on the screen, then just reuse them for showing the others, eg. when the users scrolls. That's the idea of the collection views and table views - use them instead or implement your own reusable mechanism.

graver
  • 15,183
  • 4
  • 46
  • 62
1

You have to do all your UI changes in the main thread. You can create UIView in background mode, but call addSubview: method in main thread.

( Thanks Minerva )

Gago
  • 297
  • 1
  • 9