changeset 2450:2c03987c95bd

iOS: Fix dw_window_set_bitmap*() on buttons... uses a different method on iOS for the ImageView than the button, on MacOS they were the same.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 10 Apr 2021 20:09:58 +0000
parents 6edaa9382046
children 44b77654c406
files ios/dw.m
diffstat 1 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Sat Apr 10 00:34:34 2021 +0000
+++ b/ios/dw.m	Sat Apr 10 20:09:58 2021 +0000
@@ -8506,7 +8506,7 @@
 {
     id object = handle;
 
-    if([ object isKindOfClass:[ UIImageView class ] ] || [ object isKindOfClass:[ UIButton class ]])
+    if([object isKindOfClass:[UIImageView class]] || [object isMemberOfClass:[DWButton class]])
     {
         if(data)
         {
@@ -8516,7 +8516,16 @@
 
             if(pixmap)
             {
-                [object setImage:pixmap];
+                if([object isMemberOfClass:[DWButton class]])
+                {
+                    DWButton *button = object;
+                    [button setImage:pixmap forState:UIControlStateNormal];
+                }
+                else
+                {
+                    UIImageView *iv = object;
+                    [iv setImage:pixmap];
+                }
             }
             /* If we changed the bitmap... */
             Item *item = _dw_box_item(handle);
@@ -8550,7 +8559,7 @@
     id object = handle;
     DW_LOCAL_POOL_IN;
 
-    if([ object isKindOfClass:[ UIImageView class ] ] || [ object isKindOfClass:[ UIButton class ]])
+    if([object isKindOfClass:[UIImageView class]] || [object isMemberOfClass:[DWButton class]])
     {
         UIImage *bitmap = nil;
 
@@ -8574,7 +8583,16 @@
 
         if(bitmap)
         {
-            [object setImage:bitmap];
+            if([object isMemberOfClass:[DWButton class]])
+            {
+                DWButton *button = object;
+                [button setImage:bitmap forState:UIControlStateNormal];
+            }
+            else
+            {
+                UIImageView *iv = object;
+                [iv setImage:bitmap];
+            }
 
             /* If we changed the bitmap... */
             Item *item = _dw_box_item(handle);