Results 1 to 3 of 3
Discuss [Question] [Solved] Portrait / Landscape at the iPhone Developer Exchange - Hackint0sh.org; Hello all. I'm developing a demo and as I'd never developed in objective-c, it's very ...
  1. #1
    Newbie Array

    Join Date
    Oct 2007
    Location
    Argentina
    Posts
    7
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default [Question] [Solved] Portrait / Landscape

    Hello all. I'm developing a demo and as I'd never developed in objective-c, it's very difficult for me.
    My question sure have a silly answer, but I cant find it in internet nor this and other forums...

    Here I go.

    I have a view with a label on the center and want the view to rotate when the device is rotated...

    My code is quite simple:

    Code:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return YES;
    }
    
    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
    								duration:(NSTimeInterval)duration {
    	switch (toInterfaceOrientation) {
    		case UIInterfaceOrientationPortrait:
    			[label setText: @"Portrait"];
    			break;
    		case UIInterfaceOrientationPortraitUpsideDown:
    			[label setText: @"Portrait Upside Down"];
    			break;
    		case UIInterfaceOrientationLandscapeLeft:
    			[label setText: @"Landscape Left"];
    			break;
    		case UIInterfaceOrientationLandscapeRight:
    			[label setText: @"Landscape Right"];
    			break;
    	}
    }
    But the result is not as I expect. What happens is the following:
    In portrait mode, everything works fine, but in landscape mode, the view doesn't fill the screen... it remains with the same width as in portrait mode and it's very ugly...
    I can't find what I'm missisng here!!!

    Also, how do I relocate the label to position it in the center?



    Thanks in advance.



  2. #2
    Advanced Array

    Join Date
    Feb 2008
    Posts
    45
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    You have to change its frame. its still shaped 320x480.
    view.frame=CGRectMake(0,0,480,320);

    should do it.

  3. #3
    Newbie Array

    Join Date
    Oct 2007
    Location
    Argentina
    Posts
    7
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default Thanks!

    Thanks! I was about to post that I'd found just that.


    Thanks!

 

 

Similar Threads

  1. Slashdot: Apple Patents Portrait-Landscape Flipping
    By hackint0sh in forum Latest Headlines
    Replies: 0
    Last Post: 07-15-2011, 03:10 AM
  2. [Question] [Solved] Jailbreaking with no sim
    By JMF81 in forum iPhone 3G
    Replies: 10
    Last Post: 01-13-2009, 07:26 AM
  3. [Question] [Solved] Cycorder videos?
    By nasty devil in forum Free Toolchain Software (Cydia App's)
    Replies: 2
    Last Post: 12-23-2008, 12:51 AM
  4. [question] [Solved] can i unlock 2.1?
    By edgaris in forum Hardware Unlock
    Replies: 2
    Last Post: 11-14-2008, 02:55 PM
  5. [Question] [Solved] is the 3g unlockable?
    By heyhi in forum iPhone 3G
    Replies: 6
    Last Post: 11-10-2008, 03:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 06:57 AM.
twitter, follow us!