0

For my app, I would like to have some sort of view that will hold an image (specifically, an image of my office's floor plan). As the image does not fit in the screen, I should be able to pan it.

I also intend to have two buttons (outside of the view?) to go up a level and go down a level and these will change the floor plan image correspondingly.


My question is: should I create a class for "MyMapView" or one for "MyMapViewController", or both?

And also, should I extend UIScrollView/UIScrollViewController or create an instance of this as a property of the map class I'm creating?

Leo
  • 24,596
  • 11
  • 71
  • 92
CrazyJony
  • 925
  • 1
  • 9
  • 12

2 Answers2

0

According to me you should create MyMapView class extending from UIView. Then create instance variable as UIScrollView in it. Put an imageView having your floor plan image. Apply pan gesture on it show that user can see it by panning. You can follow below link also:

Pinch To Zoom Effect on UIImageView inside scrollView?

Community
  • 1
  • 1
0

Both. View controllers and views serve two different purposes. View controllers control views, as the name implies.

So, make a view controller. There is a default view in a view controller; you can use it or replace it. In your case you probably want to add a UIScrollView to it and put a UIImageView on top of that. Then load the UIImageView with whatever floor plan you want. Add some gesture recognizers, a control to swap between the floors, wire it all up, and you're set.

Michael Olenick
  • 458
  • 4
  • 11