changeset 2831:adb0e4ce9347

iOS: Fix multi-line container display, had to stop using buttons for images. Still need to connect the signal handlers to the column buttons. Switch to using Multi-line container mode in the test program on mobile.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sat, 10 Sep 2022 22:03:47 +0000
parents cc9258ba53d7
children df16bb0a11b2
files dwtest.c ios/dw.m
diffstat 2 files changed, 8 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/dwtest.c	Fri Sep 09 08:42:22 2022 +0000
+++ b/dwtest.c	Sat Sep 10 22:03:47 2022 +0000
@@ -2193,8 +2193,8 @@
         dw_feature_set(DW_FEATURE_DARK_MODE, DW_DARK_MODE_FULL);
 
 #ifdef DW_MOBILE
-    /* Enable extra container display on Mobile platforms */
-    dw_feature_set(DW_FEATURE_CONTAINER_MODE, DW_CONTAINER_MODE_EXTRA);
+    /* Enable multi-line container display on Mobile platforms */
+    dw_feature_set(DW_FEATURE_CONTAINER_MODE, DW_CONTAINER_MODE_MULTI);
 #endif
 
     /* Initialize the Dynamic Windows engine */
--- a/ios/dw.m	Fri Sep 09 08:42:22 2022 +0000
+++ b/ios/dw.m	Sat Sep 10 22:03:47 2022 +0000
@@ -2404,6 +2404,9 @@
 
         /* Extra mode stack is horizontal, multi stack is vertical */
         [stack setAxis:(extra ? UILayoutConstraintAxisHorizontal : UILayoutConstraintAxisVertical)];
+        /* For Multi-line, we don't want fill, we want leading */
+        if(!extra)
+            [stack setAlignment:UIStackViewAlignmentLeading];
 
         /* Create the stack using columndata, reusing objects when possible */
         for(id object in columndata)
@@ -2418,12 +2421,7 @@
                     id oldview = [subviews objectAtIndex:index];
 
                     if([oldview isMemberOfClass:(extra ? [UILabel class] : [UIButton class])])
-                    {
                         label = oldview;
-                        /* If we are reusing a button, make sure the image is not set */
-                        if(!extra)
-                            [label setImage:nil forState:UIControlStateNormal];
-                    }
                     else
                         [stack removeArrangedSubview:oldview];
                 }
@@ -2456,19 +2454,14 @@
                 {
                     id oldview = [subviews objectAtIndex:index];
 
-                    if([oldview isMemberOfClass:(extra ? [UIImageView class] : [UIButton class])])
-                    {
+                    if([oldview isMemberOfClass:[UIImageView class]])
                         image = oldview;
-                        /* If we are reusing a button, make sure the text is not set */
-                        if(!extra)
-                            [image setTitle:nil forState:UIControlStateNormal];
-                    }
                     else /* Remove the view if it won't work */
                         [stack removeArrangedSubview:oldview];
                 }
                 if(!image)
                 {
-                    image = extra ? [[UIImageView alloc] init] : [UIButton buttonWithType:UIButtonTypeCustom];
+                    image = [[UIImageView alloc] init];
 
                     [image setTranslatesAutoresizingMaskIntoConstraints:NO];
 
@@ -2478,10 +2471,7 @@
                         [stack addArrangedSubview:image];
                 }
                 /* Set the image view or button image */
-                if(extra)
-                    [image setImage:object];
-                else
-                    [image setImage:image forState:UIControlStateNormal];
+                [image setImage:object];
 
                 index++;
             }
@@ -2617,10 +2607,7 @@
 
     /* The data is already a DWTableViewCell so just return that */
     if([cell isMemberOfClass:[DWTableViewCell class]])
-    {
         height = [[cell contentView] systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
-        NSLog(@"Calculated height %f\n", (float)height);
-    }
     return height > 0.0 ? height : UITableViewAutomaticDimension;
 }
 -(CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath