# Detect Rotation and Switch View

**URL:** <https://forum.xojo.com/t/detect-rotation-and-switch-view/51585>\
**Category:** iOS\
**Created:** [December 12, 2019, 9:39pm UTC](https://forum.xojo.com/t/detect-rotation-and-switch-view/51585 "2019-12-12T21:39:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Halford](https://forum.xojo.com/user_avatar/forum.xojo.com/chris_halford/32/480_2.png) [@Chris\_Halford](https://forum.xojo.com/u/Chris_Halford)\
**Post date:** [December 12, 2019, 9:39pm UTC](https://forum.xojo.com/t/detect-rotation-and-switch-view/51585/1 "2019-12-12T21:39:49Z")

</div>

I’d like to prevent most of the views in my app from rotating, but have one rotate. I don’t think that’s possible (easily) so I’ll live with them all rotating.  
However I would like one one specific view for the rotation to trigger pushing to another view that is intended for landscape viewing.

Basically I have a long list on one view and when it’s on it’s side I’d like to be able to plot in graphical representation of the data.

Anyone?

---

<div class="post-metadata">

**Author:** ![Art\_Gorski](https://forum.xojo.com/user_avatar/forum.xojo.com/art_gorski/32/704_2.png) [@Art\_Gorski](https://forum.xojo.com/u/Art_Gorski)\
**Post date:** [December 13, 2019, 5:57pm UTC](https://forum.xojo.com/t/detect-rotation-and-switch-view/51585/2 "2019-12-13T17:57:52Z")

</div>

I’ve got a view that’s only used on the iPad in a splitview and I display a warning message if the iPad is in portrait such that you can’t see the master view (it’s there if you swipe, but most people don’t know that). So in the Activate and Resized events of that view I have:

[code]// Check for portrait orientation  
Dim width As Integer = Self.Size.Width

If width = 768 OR width = 834 OR width = 1024 Then  
WarningLabel.Visible = True  
Else  
WarningLabel.Visible = False  
End If[/code]

Seems awkward to me, but this is what I found to work. Interested in a more elegant solution.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:12pm UTC](https://forum.xojo.com/t/detect-rotation-and-switch-view/51585/3 "2021-04-29T16:12:59Z")

</div>


