0

I'm trying to use Apple's Alternate Views sample code.

My app is going to add buttons to the view when rotated, like Apple's default Calculator app, so it's going to share a lot of the same code. In the example, they have one view controller and two UIView subclasses, LandscapeView and PortraitView, that they switch between on rotation.

Both views are going to have the same outputs, but landscape is going to have more actions. How and where would I put this kind of code? In the view controller or the separate view classes?

For example, would I declare the actions in the view controller, so that they set the outlet labels declared in the two views?

I'm wondering, with one view controller and two views, how to set up the variables and outlets that can be shared. In the sample code, it doesn't look like the landscape and portrait views inherit from the view controller, so I don't think that making the classes abstract would work.

jscs
  • 63,694
  • 13
  • 151
  • 195

1 Answers1

0

Use the same ViewController and update your view programatically whenever orientation changes(make buttons visible or change their frames). check out this answer to see how to get orientation changes; https://stackoverflow.com/a/16959059/3343031

Community
  • 1
  • 1
Deimt
  • 31
  • 2