ios - Adding large number of images in scrollView takes lot of time with stuck UI -


hi making ios application in want show 1000 uimageview in scrollview. have placed images in project hirarichy having names

1_image.png 2_image.png 3_image.png . . . 1000_image.png 

now in viewcontroller's viewwillappear is, loading images in uiimageview in loop , add scrollview subview after setting frame.

it works fine problem when attempt present vc takes lot of time stuck ui since loading 1000 images.

i stuff in single folder , here snippest

-(void)addimages {   for(i=0 i<1000 i++)   {     image     set in imageview     setframe of imageview     add scrollview subview   } } 

if attempt perform method in background not sure there problems since uikit elements not thread safe , can cause problem when manipulating them in background thread.

what best practice of doing it. please advice

may need uipageviewcontroller or uicollectionviewcontroller


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -