I am trying to display a 3rd party UIView, which basically contains an image with some clickable (touchable) regions. For example, it contains a region, that when clicked, launches a web page. I created a UIViewController for this which is supposed to show this UIView as a full screen. I know the width and height of the image, so I need to scale this view to fit the full screen.
Here is my problem: When I try to scale the image, the clickable regions in the subview are no longer clickable.
Here is how I am doing the scaling:
float scalingFactor = (adAspectRatio > deviceAspectRatio) ? deviceWidth / adWidth : deviceHeight / adHeight;
float scaledWidth = adWidth * scalingFactor;
float scaledHeight = adHeight * scalingFactor;
adFrame = CGRectMake((deviceWidth - scaledWidth) / 2.0f, (deviceHeight - scaledHeight) / 2.0f, adWidth, adHeight);
thirdpartyview.transform = CGAffineTransformScale(CGAffineTransformIdentity, scalingFactor, scalingFactor);
[thirdpartyview setFrame:adFrame];
...
[self.view addSubview:thirtpartyview];
On doing the transform, all the touches now go to my view controller, instead of that subview. Now I can't click anything. If I do not do the transform, or if I do the transform but using identity, everything works, but it is not scaled as I want it to. When I transform, it scales correctly, but the touches don't work.
If I try to detect touches on the view controller, I am able to receive touch events. But I don't know how to forward the touch events to the thirdparty view.
Any suggestions?