OpenFlow icon indicating copy to clipboard operation
OpenFlow copied to clipboard

Open Flow as subview - positioning issue

Open jregan opened this issue 15 years ago • 1 comments

When an AFOpenFlow view is used as a subview, the OpenFlow view is moved to the enclosing view's 0,0 coordinate regardless of where it's placed in the layout in InterfaceBuilder. This is not immediately apparent as the covers are drawn in the correct spot - however the enclosing view may be shifted up in the enclosing view. (Changing the OpenFlow views background to something other than "clear" will make this apparent.)

I noticed this when touches/swipes on the bottom of the OpenFlow view didn't register. The bottom of the covers is effectively cut off from getting the touches since the view is shifted up.

A fix that's working for me thus far involves changing the following code in the AFOpenFlowView in the setUpIntitalState method:

line 65: self.layer.position=CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);

I converted this point into the context of the superview:

CGPoint layerRelPt = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2); self.layer.position = [self convertPoint:layerRelPt toView:self.superview];

Further testing needs to be done but so far, so good.

jregan avatar Dec 30 '10 14:12 jregan

I just removed the self.layer.position change line and it seems to work okay for me.

But still looking into other issues in regards to using OpenFlow as a subview on the iPad...

dejo avatar Mar 03 '11 17:03 dejo