Reputation: 3760
I have a UIView/UIScrollView with non rectangular sections, let's call them room plans. The UIView/UIScrollView should be zoomable. When the user clicks to a non rectangular region/room, I should be able to detect which region was clicked and let's say open up the detailed floorplan of that particular room. The problem is that 1. when I zoom in and out, the 'button' size must change. 2. the button is not rectangular.
see an example of what I am trying to implement in iOS. http://www.occc.net/ifp/
Any ideas of how to approach this problem are welcome.
Thank!
Upvotes: 0
Views: 375
Reputation: 881
I was trying to do a similar thing there. What i did was use a UIImageView within a UIScrollView and load the image in the UIImageView.
I did this in my viewDidLoad :
scrollMap.minimumZoomScale=1;
scrollMap.maximumZoomScale=2.0;
scrollMap.delegate=self;
Then added this function :
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.imgMap;
}
This made the image inside the scrollview zoomable with the aspect ratio of the scrollview. It worked for me. You can try, this might work for you too.
Thanks.
Upvotes: 1
Reputation: 6342
you can use OBShapedButton, i found on github and i have used in more than three apps.
It is very easy to implement you should try this.....
Upvotes: 0