0

I have the following hierarchy: view scrollview(with scroll and zoom enabled) containerview imageview (with a map) views for buttons views for navigation panel

Over the image view I have to put some point of interest (depending on the category the user selects): The problems are: if i attach them to the container view, they getting the correct position is very easy, but when zooming they will zoom with the image, and they should keep the same size (1) if i attach them to the scrollview I don’t see nothing.. If I attach them to the main view, I have two problems: 1 to find their hierarchy position in between scrollview and view for buttons, etc (they get at the top of the application and should be just over the map but below the control panels, buttons, etc 2 to coordinate with the zoom and scroll- done with convertPoint:toView If I add a view (sibling of container view under the scrollview) they show fine, but I have no user input on them (They don’t receive touches) If I convert that sibling subview to a CALayer, I don’t get the sublayers (POIs) to shown.

(1) Ive tried to subclass container view and override setTransform by applying CGAffineTransform invertedTransform = CGAffineTransformInvert(transform); but I had problems passing it an array with views references to it

What would you recommend to do in this case? Thank you very much!

S.

user63391
  • 1
  • 2
  • If you have solved your own problem, you would be better off writing an answer to your own question and accepting it, rather than editing the question. – jrturton Jun 17 '14 at 07:50
  • Hi jrturton, thank you very much for your comment. I'm new at SO. Have nice day.. – user63391 Jun 18 '14 at 09:23

1 Answers1

0

I've finally added subviews to containerView and I've subclassed it:

- (void)setTransform:(CGAffineTransform)transform
{
    [super setTransform:transform];

    CGAffineTransform invertedTransform = CGAffineTransformInvert(transform);
    for (UIView *view in self.subviews)
    {
        if ([view isKindOfClass:[MarkerClass class]]) {
            [view setTransform:invertedTransform];
        }
    }
}

The only problem is that before I zoom the containerView, a short sized version of the markers appear on the screen.

After passing some time, I've found I would override addSubview too, to get an initial transform in this way:

-(void)addSubview:(UIView *)view {
    [super addSubview:view];
    if ([view isKindOfClass:[MarkerClass class]]) {
     CGAffineTransform invertedTransform = CGAffineTransformInvert(self.transform);
        [view setTransform:invertedTransform];
    }
}
user63391
  • 1
  • 2