Flow Layout Editable without Deletion


#1

Hi,

I have been trying to use the Flow Control to allow the views to be dragged and rearranged, but to hide the deletion features.

How do I go about disabling delete?

Thanks for any help!


#2

It does seem a bit of an awkaward design that edit and delete are bundled together as concepts; certainly they are concepts that need to be managed independently.  Nonetheless, I was able to ‘turn off’ deletion by doing the following:

  • First of all I configured a style with empty images and then configure my flow with that style:
UIImage *blankImage = [[UIImage alloc] init];
    SEssentialsFlowLayoutStyle *flowStyle =
        [[SEssentialsFlowLayoutStyle alloc] initWithTheme:[SEssentialsTheme sharedTheme]
                                            trashcanImage:blankImage
                                             trashcanMask:blankImage
                                          doneButtonImage:blankImage
                                   doneButtonPressedImage:blankImage
                                              deleteImage:blankImage
                                       deletePressedImage:blankImage];

        UIView *frameLayoutPositionView = ...;
        CGRect frame = frameLayoutPositionView.frame;

        SEssentialsFlowLayout *nextLayout =
            [[SEssentialsFlowLayout alloc] initWithFrame:frame
                                         withDeleteIdiom:SEssentialsFlowDeleteIdiomTrashCan
                                                   style:flowStyle];
  • In my delegate I returned a point way outside of the visible area so that it was unreachable by the user:

    • (CGPoint) flowLayout:(SEssentialsFlowLayout *)flow deleteIconPositionInView:(UIView *)view {
      // Disallow delete
      return CGPointMake(-1024.0f, -1024.0f);
      }

#3

Hey guys,

You could just pass nil in as the parameter to the style object instead of using a blank image. Also, to disable the deleting capability, (after removing the images) I would implement my shouldRemoveView method in my delegate and return NO:

- (BOOL)flowLayout:(SEssentialsFlowLayout *)flow shouldRemoveView:(UIView *)view
{
    return NO;
}

Thanks,

Jan