Skip to content

insertSubview:at: seems to be off by one #308

@janek

Description

@janek

Problem

insertSubviews seems to be off by one, running the same code on iOS and macOS gives a different view hierarchy. Code to reproduce this in our DemoApp is attached at the bottom of the post, shortened pseudode below.

Pseudocode:

add 3 square views 
insert a blue horizontal view at index #1

Results:

iOS macOS
Screenshot 2020-02-18 at 14 23 16 Screenshot 2020-02-18 at 14 41 18
Correct, blue view seems to be on the position with index 1 Incorrect, blue view seems to be on position with index 2

Note: this does not affect inserting at index 0 - that one behaves correctly

Snippets for reproduction and debugging

DemoAppControllerForInsertSubviewsTesting.txt
testScrollIndicatorsHierarchyPosition.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions