jazzzzzzz Active Member Licensed User Longtime User Jul 11, 2016 #1 I need to change the toprightbutton icon I wrote the code below but it gives the error below at btnlist.set().Can someone help change the icon in run time? btnlist have 2 items Am trying to change the 2nd item. When i Log btnlist.isreadonly it shows true,I dont know why the array is readonly Code: Dim btnList As List = contestImages.TopRightButtons Dim btn As BarButton btn.InitializeBitmap(LoadBitmap(File.DirAssets,"ic_dashboard.png"),"changeview") btnList.Set(1,btn) contestImages.TopRightButtons = btnList Code: changeview Error occurred on line: 53 (contestImagesCode) -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x16e06400 Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 CoreFoundation <redacted> + 702 CoreFoundation _CF_forwarding_prep_0 + 24 Snap'n'Win -[B4IList Add:] + 178 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 Snap'n'Win +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1780 Snap'n'Win -[B4IShell runVoidMethod] + 210 Snap'n'Win -[B4IShell raiseEventImpl:method:args::] + 2154 Snap'n'Win -[B4IShellBI raiseEvent:event:params:] + 1442 Snap'n'Win __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 22 libdispatch.dylib _dispatch_main_queue_callback_4CF + 1532 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1590 CoreFoundation CFRunLoopRunSpecific + 516 CoreFoundation CFRunLoopRunInMode + 108 GraphicsServices GSEventRunModal + 160 UIKit UIApplicationMain + 144 Snap'n'Win main + 108 libdyld.dylib <redacted> + 2 )
I need to change the toprightbutton icon I wrote the code below but it gives the error below at btnlist.set().Can someone help change the icon in run time? btnlist have 2 items Am trying to change the 2nd item. When i Log btnlist.isreadonly it shows true,I dont know why the array is readonly Code: Dim btnList As List = contestImages.TopRightButtons Dim btn As BarButton btn.InitializeBitmap(LoadBitmap(File.DirAssets,"ic_dashboard.png"),"changeview") btnList.Set(1,btn) contestImages.TopRightButtons = btnList Code: changeview Error occurred on line: 53 (contestImagesCode) -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x16e06400 Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 CoreFoundation <redacted> + 702 CoreFoundation _CF_forwarding_prep_0 + 24 Snap'n'Win -[B4IList Add:] + 178 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 292 Snap'n'Win +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1780 Snap'n'Win -[B4IShell runVoidMethod] + 210 Snap'n'Win -[B4IShell raiseEventImpl:method:args::] + 2154 Snap'n'Win -[B4IShellBI raiseEvent:event:params:] + 1442 Snap'n'Win __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 22 libdispatch.dylib _dispatch_main_queue_callback_4CF + 1532 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1590 CoreFoundation CFRunLoopRunSpecific + 516 CoreFoundation CFRunLoopRunInMode + 108 GraphicsServices GSEventRunModal + 160 UIKit UIApplicationMain + 144 Snap'n'Win main + 108 libdyld.dylib <redacted> + 2 )
Erel B4X founder Staff member Licensed User Longtime User Jul 11, 2016 #4 As this is a read only list you cannot modify it. You need to do: Code: Dim btnList As List btnList.Initialize btnList.AddAll(contestImages.TopRightButtons) Upvote 0
As this is a read only list you cannot modify it. You need to do: Code: Dim btnList As List btnList.Initialize btnList.AddAll(contestImages.TopRightButtons)