How to lock view controller in portrait orientation?

I have made and app in storyboard with the ability to use portrait and landscape orientation. However, one view requires to be locked in the portrait orientation? How do i do this?

It seems like this should work but it's not. Tell me if i placed this is the right location please. It goes in the ViewController.m file.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    return self;
- (BOOL)shouldAutorotate
    return NO;
- (void)viewDidLoad
    [super viewDidLoad];
Is this the correct spot?
Thanks!

Similar Messages

  • Adobe Content Viewer stuck in portrait orientation

    I just spoke to a customer who can only see the Adobe Content Viewer (both versions 1.7 and 1.8) in portrait orientation.  His device is rotated horizontally and the Android GUI is correctly displaying in landscape mode.  He launches the Adobe Content Viewer and the interface of the app is in portrait mode.  No amount of rotating makes a difference.  This happens in the Library view and when viewing a folio.  The Xoom I’m using doesn’t have this problem.  We have essentially identical setups with very few downloaded apps or custom setup, however his Xoom is only displaying the Adobe Content Viewer in portrait orientation.  Anyone else have this issue and/or a possible solution?  I’m having difficulty coming up with my next troubleshooting step.  It’s not a problem with Android as a whole, just the Adobe Content Viewer.
    Andrew

    Hey guys, I'm sorry, I just now saw that this post got replies. Sorry!
    In the end, it worked out that I had to view it on the actual device. The desktop viewer seems very finicky - sometimes it'll work and sometimes it won't.
    It's not very handy to have to view it on the actual device. Sometimes you won't always have the device you're designing for on hand! Hopefully Adobe will recognize that.
    Good luck guys!

  • How to record a video in portrait orientation?

    I am developing an app which uses MediaCapture class to record videos. I want to give user freedom to record video in either portrait or landsapce by just rotating the device. Please note my app has fixed portrait orientation. Due
    to fixed orientation, I am using OrientationChanged event of class SimpleOrientationSensor.
    Now I have noticed that the portait video recorded in default camera app and in my app has some differences. You can see the difference in below given images. All the videos are in 720p resolution. The player images are of portrait
    locked orientation. The code is also given below. Can any one explain me what's wrong with my code to record the portrait video? Thanks!
    MediaCaptureInitializationSettings set;
    MediaCapture _camCapture;
    VideoRotation videoRotation = VideoRotation.None;
    bool _isRecording = false;
    // Camera resource disposal is handled properly
    private async Task InitializeCamera()
    try
    if (set == null)
    set = new MediaCaptureInitializationSettings();
    DeviceInformation deviceID = (await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture))
    .FirstOrDefault(x => x.EnclosureLocation != null && x.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back);
    if (deviceID != null)
    set.VideoDeviceId = deviceID.Id;
    _camCapture = new MediaCapture();
    await _camCapture.InitializeAsync(set);
    VideoView.Source = _camCapture; //VideoView is CaptureElement object in XAML
    _camCapture.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
    await _camCapture.StartPreviewAsync();
    catch (Exception ex)
    private async void OrientationChanged(object sender, SimpleOrientationSensorOrientationChangedEventArgs e)
    try
    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
    DetectCurrentOrintation(e.Orientation);
    catch (Exception ex)
    private void DetectCurrentOrintation(SimpleOrientation orientation)
    try
    switch (orientation)
    case SimpleOrientation.NotRotated:
    videoRotation = VideoRotation.Clockwise90Degrees;
    break;
    case SimpleOrientation.Rotated90DegreesCounterclockwise:
    videoRotation = VideoRotation.None;
    break;
    case SimpleOrientation.Rotated180DegreesCounterclockwise:
    videoRotation = VideoRotation.Clockwise270Degrees;
    break;
    case SimpleOrientation.Rotated270DegreesCounterclockwise:
    videoRotation = VideoRotation.Clockwise180Degrees;
    break;
    default:
    break;
    catch (Exception ex)
    private async void btnRecordVideo_Click(object sender, RoutedEventArgs e)
    try
    if (!_isRecording)
    var _videoRecording = await MyFolderInLocalFolder.CreateFileAsync("testRecord.mp4", CreationCollisionOption.GenerateUniqueName);
    MediaEncodingProfile mEncode = MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Auto);
    _isRecording = true;
    //Two videos are with SetRecordRotation(value) and
    //for two other I commeted out the line.
    _camCapture.SetRecordRotation(videoRotation);
    await _camCapture.StartRecordToStorageFileAsync(mEncode, _videoRecording);
    else
    await _camCapture.StopRecordAsync();
    _isRecording = false;
    catch (Exception ex)

    Hello,
    I would recommend that you modify your code to match the
    Media Capture sample's advanced capture scenario. Instead of using SimpleOrientationSensorOrientationChangedEventArgs.Orientation use Windows.Graphics.Display.DisplayInformation.
    Here is the code from the sample:
    private void DisplayInfo_OrientationChanged(Windows.Graphics.Display.DisplayInformation sender, object args)
    m_displayOrientation = sender.CurrentOrientation;
    OrientationChanged();
    private void PrepareForVideoRecording()
    try
    if (m_mediaCaptureMgr == null)
    return;
    bool counterclockwiseRotation = m_bReversePreviewRotation;
    if (m_bRotateVideoOnOrientationChange)
    m_mediaCaptureMgr.SetRecordRotation(VideoRotationLookup(m_displayOrientation, counterclockwiseRotation));
    else
    m_mediaCaptureMgr.SetRecordRotation(Windows.Media.Capture.VideoRotation.None);
    catch (Exception exception)
    ShowExceptionMessage(exception);
    private Windows.Media.Capture.VideoRotation VideoRotationLookup(
    Windows.Graphics.Display.DisplayOrientations displayOrientation,
    bool counterclockwise)
    switch (displayOrientation)
    case Windows.Graphics.Display.DisplayOrientations.Landscape:
    return Windows.Media.Capture.VideoRotation.None;
    case Windows.Graphics.Display.DisplayOrientations.Portrait:
    return (counterclockwise) ? Windows.Media.Capture.VideoRotation.Clockwise270Degrees :
    Windows.Media.Capture.VideoRotation.Clockwise90Degrees;
    case Windows.Graphics.Display.DisplayOrientations.LandscapeFlipped:
    return Windows.Media.Capture.VideoRotation.Clockwise180Degrees;
    case Windows.Graphics.Display.DisplayOrientations.PortraitFlipped:
    return (counterclockwise) ? Windows.Media.Capture.VideoRotation.Clockwise90Degrees :
    Windows.Media.Capture.VideoRotation.Clockwise270Degrees;
    default:
    return Windows.Media.Capture.VideoRotation.None;
    I hope this helps,
    James
    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

  • How do you print calendar in portrait orientation

    how do you change the print orientation of the calendar from landscape to portrait? -- richard

    Hi macshine and all others that wanted to figure this one out,
    This one plagued me as well and through 15 different threads giving old info that is no longer relevant I finally figued it out.
    You need to create an 8.5x8.5 paper size.  From Safari or most any program (except calendar) select print.  In the printer options there is a pull down menu called "paper size".  It's most likely already selected "US Leter".  Select "Mange Custom Sizes" and create a new paper size.  Call it whatever you want.  Make the paper size 8.5in x 8.5in and hit okay.
    What you are doing is tricking the progam with this option.  If you made a 8.5 in wide by 11 tall paper size it would still set it up in landscape.  When you select your new square option it throws it off and forces everything into a 8.5 inch wide page.  Now go back to the paper size pull down menu and select US letter.  Don't know why, but it now lays eveything out in portrait mode.  You will need to select your square paper size first and then the US letter size everytime you want to print in portrait.
    I hope this helps.

  • How to call view-controller method out of componentcontroller

    Hello all,
    my component implements a component-interface with method BACK.
    Thus my componentcontroller has the interface Method BACK.
    When triggering BACK from an foreign component, the implementation within the componentcontroller is called. So far so good.
    Now I want to POPUP_AND_CONFIRM when BACK is hit. But this POPUP_TO_CONFIRM requires me to create an action. But I can't create an action within the componentcontroller.
    I could realize the POPUP_AND_CONFIRM within the components view. But how can I call a view-method out of the componentcontroller?
    Or does anybody have a better solution? (Maybe I could implement BACK within the view, but how to connect the componentcontroller-back-method with the views back-method?)
    Thank you very much in advance...
    Regards
    I. Durmaz

    You should never attempt to call view methods from outside the view.  It is possible to register popop event handlers to methods of the component or custom controllers.  From the online help:
    For a few special cases it is useful to register event handlers for component controllers or custom controllers on the button events of a dialog box. For these cases, a special POPUP_TO_CONFIRM attribute of type IF_WD_POPUP_TO_CONFIRM_N has been implemented in the IF_WD_WINDOW interface. This interface provides precisely the methods with which event handlers for component and custom controllers can be registered on events of the dialog box.
    http://help.sap.com/saphelp_nw70ehp2/helpdata/en/47/b9487e01602fe2e10000000a42189d/frameset.htm

  • How to get 2560x1080 resolution in Portrait orientation in a 21:9 monitor

    Recently, i just own a monitor with the ratio 21:9. I found that when i change my orientation to 90 degrees, it only has 1920x1080 resolution and there is no 2560x1080 resolution so the screen is streched. How can i fix this problem?

    Try the Thunderbolt connection.
    <http://store.apple.com/us/product/MD861ZM/A/apple-thunderbolt-cable-20-m>

  • How to create a movie in portrait orientation?

    Good day
    Today I took some movies on my iPhone in portait orientation. Now I wanted to stick them in iMovie together and ad some text etc. But sadly the project is now in landscape orientation and squeezed together with black edges.
    Is it possible to change to fromat of the iMovie project from landscape to portait?
    Thanks for your tipps!
    C

    Thanks for your input - but then I will have to cut it into pieces and end up with an landscape movie.
    I would like to change the green cropping tool to portait...

  • My portrait orientation got locked   How do you unlock it

    How do I unlock the portrait orientation

    I just figured this out:
    To get rid of that annoying portrait orientation lock symbol of the padlock with the circle around!
    Double click the home button
    Your home screen apps fade and there will be four icons along the bottom of the screen.
    scroll left until you see the Portrait Orientation Lock symbol.
    Touch it
    Portrait orientation Unlocked!

  • Portrait Orientation Lock

    I have an iPod 4th Generation that is using the 5.1.1 iOS.
    Somehow my viewing orientation got locked in portrait orientation. How do I unlock the portrait orientation?
    I'm kind of new at this orientation stuff. I just know that when I want landscape view I just turn the iPod right or left &amp; the screen adjusted before &amp; now it isn't doing that.
    Please help me I can't play some of my games because they need landscape view.
    Thank you in advance.
    Sincerely,
    john_r_l

    double tap the home button and swipe the bottom of the screen that just popped up.  left to right you will see a button with a circular arrow.  if it is locked, you will see a lock in the middle, press it to unlock
    like in this video:  http://www.youtube.com/watch?v=s2RaAKz2Oy0

  • Secondary monitor on 20"iMac, How to set portrait orientation when running

    How do you set the display rotation in Windows XP?
    I have a secondary monitor (wall-mounted at 90 degrees to normal) that OS X handles just fine (the display preference window provides a rotate function). However, when running Windows XP, the secondary monitor is still available, but I can not find a setting that will rotate the display. I downloaded the Apple Boot Camp ATI driver from AMD's site and the driver version went from 8.39 to 8.43. Still no visible way to rotate the secondary display. I then upgraded Boot Camp to 2.1 after which the ATI driver version went to 8.45. Still no rotate functionality.
    I have tried using the ALT-OPTION-ARROW key with no success (recommended on some obscure Windows XP forum). I also downloaded the Apple Boot Camp Crystal Control Center from the AMD site, but it would not execute after installation (this upon yet another obscure recommendation).
    I also have Windows XP on my MacBook. It uses an NVIDIA driver and it will allow display rotation.
    Any help or advice is appreciated.

    Updating my original post:
    I have resolved the issue. The ATI Catalyst Control Center app (I meant Catalyst, not Crystal in my original post) needs Microsoft's .NET Framework 2.0, which was not included in my original Windows XP installation.
    After downloading and installing the .NET Framework 2.0 package and reinstalling the Catalyst Control Center app, I am now able to rotate the secondary monitor display to the portrait orientation.
    I use the secondary monitor primarily viewing on-line documentation while working with an application on the primary screen. The portrait orientation provides a much better environment for reading documentation as I can view 2+ pages at the same time.

  • My iPod is locked in the portrait mode, I have the portrait orientation unlocked, I restore it twice but no help.

    My iPod is locked in the portrait mode, I have the portrait orientation unlocked, I restore it twice but no help.

    I'm surprised that the restore does not fix it, which leads me to think that one of two things is going on:
    One, your acceleromter has malfunctioned. The only fix for this that I know of is to take it to a Genius Bar at an Apple Store.
    Two, you might not be holding the iPod Touch properly to make orientation work. You have to hold it vertically when you turn it if you want the orientation to change. The iPod should not be parallel to the ground, but perpendicular.
    Three, you may misunderstand how to manage the orientation function. When you bring up the running apps tray at the bottom, do you see the lock in the middle of the circular arrow? If you do, the orientation is still locked. tap it to make the lock disappear, and then open an app and see if it changes orientation
    See the two images below for locked and unlocked statuses.
    UNLOCKED:
    LOCKED:

  • How to : Support All Portrait Orientations ?

    Hello,
    One of my applications has just been rejected because it only supports Portrait orientation (home button down). So they asked me to support the 2 Portrait orientations: home button down and home button up. So when you rotate the iPad 180º,the view must rotate.
    How can I do that? It should be quite simple, but I can't figure out how.
    what I had done is:
    - (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)(interfaceOrientation
    return (interfaceOrientation == UIInterfaceOrientationPortrait)
    thank you very much! regards

    I suggest you ask your question in a developer's forum.
    http://developer.apple.com/devforums/

  • I have an iPod touch and I can't turn off the portrait orientation lock. Can anyone help?

    I have an iPod touch and I can't turn off the portrait orientation lock. Can anyone help?

    What happenw when you try to turn it off?
    iOS: Screen does not rotate
    Not all app have a landscape mode.

  • How to get the VIEW_ID from VIEW Controller Class?

    Hi,
    In my BADI(CRM_BP_UIU_VIEW_CONFIG), I have a view controller variable(IR_VIEW_CONTROLLER) referring to CL_BSP_WD_VIEW_CONTROLLER. Now, I have to get VIEW_ID using this varibale. However, the VIEW_ID attribute is Protected in the class .CL_BSP_WD_VIEW_CONTROLLER So, I am unable to access this attribute.
    Could you please help me out, how can I do achieve this?
    Thanks,
    Sandeep

    See if you can make use of GET_VIEWAREA_CONTENT or GET_VIEWAREA_CONTENT_ID...
    Regards,
    BJ

  • How to go from a View Controller to a View Controller

    Hey everyone, I have asked this question over on Stack Overflow, and really had no luck with it.
         I am wondering how to go from one (1) View Controller that has buttons and another View Controller that has a UIWebViewer in? I know how to do the simple part to get the two to link up. But, the buttons are going to have different URL's hooked up to them, and I want to be able to reuse the Web Viewer. I am using the Swift Programming language to be able to do this.
    below is my current code that is has my buttons sitting on top of my web viewer,
    import UIKit
    import WebKit
    class ViewController: UIViewController {   
        @IBOutlet var wbView: UIWebView!
        var strUrl = ""
            @IBAction func buttonAction(sender: UIButton) {
                switch (sender.tag){
                case 1:
                    strUrl = "https://www.google.co.in/"
                case 2:
                    strUrl = "https://in.yahoo.com/"
                case 3:
                    strUrl = "https://www.facebook.com/"
                case 4:
                    strUrl = "https://bing.com/"
                default:
                    break;
                reloadWebViewWithUrl(strUrl);
            func reloadWebViewWithUrl(strUrl: NSString){
                var url = NSURL(string: strUrl);
                var request = NSURLRequest(URL: url!);
                wbView.loadRequest(request);
            override func viewDidLoad() {
                super.viewDidLoad()
                // Do any additional setup after loading the view, typically from a nib.
            override func didReceiveMemoryWarning() {
                super.didReceiveMemoryWarning()
                // Dispose of any resources that can be recreated.
    How should I go about changing this two allow my buttons to be in their own ViewController and still be able to to the secondary View Controller with the WebViewer?
    Thank You all in advanced with the help on this!

    This is the FirstViewController Code
    import UIKit
    class FirstViewController: UIViewController {
        @IBAction func webAction(sender: UIButton) {
            let index = sender.tag
            chosenURLString = addresses[index]
            performSegueWithIdentifier("WebViewSegue", sender: self)
        override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
            if let controller = segue.destinationViewController as?
                SecondViewController {
                controller.urlString = chosenURLString
                chosenURLString = nil
        private let addresses = ["", "https://www.google.com", "https://www.facebook.com", "https://spca.org", "https://www.facebook.com/wagzpack?fref=photo"]
        private var chosenURLString: String?
    This is the SecondViewController Code
    import UIKit
    class SecondViewController: UIViewController {
        @IBOutlet var webSite: UIWebView!
        var urlString: String?
        override func viewDidLoad() {
            super.viewDidLoad()
            if let urlString = urlString {
                if let url = NSURL(string: urlString) {
                    let request = NSURLRequest(URL: url)
                    webSite.loadRequest(request)
                    println("loading \(urlString)")
                else {
                    println("badly formed URL string.")
            else {
                println("missing URL string.")

Maybe you are looking for

  • Issue with language specific characters combined with AD-Logon to BO platform and client tools

    We are using SSO via Win AD to logon to BO-Launchpad. Generally this is working which means for Launch Pad no manual log on is needed. But  this is not working for users which have language specific letters in their AD name (e.g. öäüéèê...). What we

  • Query problem with accumulated key figures

    Hi BI Gurus! I have a report problem that I hope you can help me with! In my report I have 2 key figures. One for accumulated revenue previous year (KF1) and one for accumulated revenue current year (KF2). Both key figures should be presented in a gr

  • Withholding tax

    Hai all,    While adding a document in  A/R invoice there is an error occurring in SAP: it is asking for withholding tax is it necessary to add?.. what change will occur if i add. ?.. can any one give the solution for this...

  • Samsung 640GB hard drive issues

    Hi Everyone, This is my first post on these forums, but have browsed them lots before and have found quite a bit of help. Unfortunately I wasn't able to find a difinitive solution and was hoping someone might have an answer for me. In November of las

  • Possible to load a dynamic plug-in through a static plug-in?

    Try to implement a static plug-in that will handle the necessarily logic for a vendors' dynamic plug-in. Does anyone know if this is possible or not? There seem to be some conflicting issues when the MediaFactory.loadPlugin has to run first in the pl