Make landscape the only autorotate orientation for all view controllers at once

I know that I have to add this

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);

to a view controller in order to make that specific screen lock in landscape mode, but do I have to do this for every view controller? Is there a way to just do a master lock that would apply to all view controllers?


You can create you own subclass of UIViewController, which implements -shouldAutorotateToInterfaceOrientation:.

Then any subclass of that will inherit the behaviour.

Need Your Help

Why I get syntax error in Rails console if my ruby version is correct?

ruby-on-rails ruby-on-rails-3 gem pry

I added gem 'pry-rails' and when i run rails console i receive following error:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.