Uibutton with png makes uiscrollview linger
I have a UIScrollView with 15 UIButtons (create with storyboard)
When I zoom in or scroll it.
Scrolling trail:
Running Time Self Symbol Name
434.0ms 100.0% 0,0 Main Thread 0x61091
434.0ms 100.0% 0,0 start
434.0ms 100.0% 0,0 main
434.0ms 100.0% 0,0 top_level_code
434.0ms 100.0% 0,0 UIApplicationMain
434.0ms 100.0% 0,0 GSEventRun
434.0ms 100.0% 0,0 GSEventRunModal
434.0ms 100.0% 0,0 CFRunLoopRunInMode
434.0ms 100.0% 0,0 CFRunLoopRunSpecific
434.0ms 100.0% 0,0 __CFRunLoopRun
417.0ms 96.0% 0,0 __CFRunLoopDoObservers
417.0ms 96.0% 0,0 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
415.0ms 95.6% 0,0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*)
413.0ms 95.1% 0,0 CA::Transaction::commit()
413.0ms 95.1% 0,0 CA::Context::commit_transaction(CA::Transaction*)
406.0ms 93.5% 0,0 CA::Layer::prepare_commit(CA::Transaction*)
406.0ms 93.5% 0,0 CA:: ::prepare_image(CGImage*, CGColorSpace*, unsigned int, double)
406.0ms 93.5% 0,0 CA::Render::copy_image(CGImage*, CGColorSpace*, unsigned int, double)
406.0ms 93.5% 0,0 CA::Render::create_image(CGImage*, CGColorSpace*, unsigned int)
406.0ms 93.5% 0,0 CGImageProviderCopyImageBlockSetWithOptions
406.0ms 93.5% 0,0 ImageProviderCopyImageBlockSetCallback
406.0ms 93.5% 0,0 copyImageBlockSetPNG
331.0ms 76.2% 0,0 _cg_png_read_row
207.0ms 47.6% 1,0 png_read_IDAT_data
203.0ms 46.7% 12,0 inflate
177.0ms 40.7% 0,0 <Unknown Address>
168.0ms 38.7% 166,0 0x257f24e
2.0ms 0.4% 0,0 i386_astintr
2.0ms 0.4% 2,0 ast_taken
3.0ms 0.6% 3,0 0x257f0cb
2.0ms 0.4% 2,0 0x257ef8b
2.0ms 0.4% 2,0 0x257efcb
1.0ms 0.2% 1,0 0x257f1f0
1.0ms 0.2% 1,0 0x257effb
10.0ms 2.3% 0,0 adler32
3.0ms 0.6% 0,0 0x257c67c
1.0ms 0.2% 1,0 0x257eee0
2.0ms 0.4% 0,0 png_crc_read
1.0ms 0.2% 0,0 <Unknown Address>
1.0ms 0.2% 1,0 0x257eee0
68.0ms 15.6% 0,0 png_read_filter_row
47.0ms 10.8% 7,0 png_do_read_transformations
7.0ms 1.6% 1,0 png_combine_row
1.0ms 0.2% 0,0 png_read_finish_IDAT
1.0ms 0.2% 1,0 _platform_memmove$VARIANT$sse42
69.0ms 15.8% 18,0 _platform_memmove$VARIANT$sse42
50.0ms 11.5% 10,0 user_trap
37.0ms 8.5% 3,0 vm_fault_internal
2.0ms 0.4% 2,0 kernel_debug
1.0ms 0.2% 0,0 <Unknown Address>
1.0ms 0.2% 1,0 thread_exception_return
2.0ms 0.4% 0,0 _cg_png_read_info
1.0ms 0.2% 0,0 ImageIO_make_read_only
1.0ms 0.2% 0,0 _cg_png_destroy_read_struct
1.0ms 0.2% 0,0 CGImageRead_mapData
1.0ms 0.2% 0,0 <Unknown Address>
1.0ms 0.2% 1,0 png_read_IDAT_data
7.0ms 1.6% 0,0 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
1.0ms 0.2% 1,0 objc_autoreleasePoolPush
1.0ms 0.2% 0,0 (anonymous namespace)::AutoreleasePoolPage::pop(void*)
2.0ms 0.4% 0,0 _afterCACommitHandler
16.0ms 3.6% 0,0 __CFRunLoopDoSources0
1.0ms 0.2% 0,0 __CFRunLoopDoTimer
Is there a way to avoid this lag? why is uiimage rendered every time? isn't it possible to do it in the background?
PS: the whole button is visible in the view.
Many thanks for your help
source to share
No one has answered this question yet
Check out similar questions: