IPhone Hello World app does not automatically rotate

Well, knowledgeable types of programmers, be careful ...

I'm having trouble creating a very simple application with one "Hello World" view for auto-rotation. I look through the usual "Hello World" steps:

Create a new project based on View.

Double-click the .xib file for ViewController.

Add an item from the Library. I tried the shortcut as well as the slider.

Change Struts and Springs to just springs to keep the element in the middle of the view.

Save and then edit the .m file for the ViewController so that it reads:
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}
*/

(Um ... Spirit, I just saw this, but I will continue the story of your entertainment.)

Save, create, run, rotate and notice that Nothing rotates when I rotate the iPhone simulator. And, no, I did not rotate my laptop ... I used keyboard shortcuts!

Disappointment set about an hour after Googling for a response. Everywhere I looked, every source said the same thing: just change the return value to yes. But still...

I am even stuck at debugger control points! None of them were hurt! (Beat, surprise!) Assuming that I did not know how to use the debugger, I hooked a breakpoint in "initWithNibName". Guess what?! It didn’t hit either! What the hell ?!

, Apple WhatWayIsUp, l33t skylz. , , "iPhone". ?!

, , , ... , , . , , , : ", is, ". .

, , , : shouldAutorotateToInterfaceOrientation "/* */" . , .

, , , , . : ", , ". , , .

n00b, . , .

, , !

+3
1

, shouldAutorotateToInterfaceOrientation . "/*" "*/", , .

+5

Source: https://habr.com/ru/post/1748445/


All Articles