Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-13-2011, 02:39 PM   #1 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default Modal View Resizing

Hi Guys,

I am seeing a really weird issue and cant figure out what the heck is going on....

I am presenting a modalviewcontroller in my application and the first time i do this everything is fine, but after that the size is getting adjusted very oddly. It looks like everything is getting pushed to the right by about 20 points, but only in landscape mode (sometimes everything is pushed to the left by about 20 points too). If I rotate, it goes back to its proper placement.

The only two places i am setting the frames for my ui elements are in viewWillAppear and shouldAutorotateToInterfaceOrientation. I printed the frame width, height, x and y in viewWillAppear and this is what I get:

First time displayed (portrait) - 320.000000 460.000000 0.000000 20.000000
Second time displayed (portrait) - 320.000000 460.000000 0.000000 20.000000
Third time displayed (landscape) - 480.000000 300.000000 0.000000
20.000000 (PROBLEM)


I've tried everything I can think of and cant figure out what the heck is going on. Any ideas?
wheli is offline   Reply With Quote
Old 07-13-2011, 03:52 PM   #2 (permalink)
Crafty Veteran
 
Magic Hands's Avatar
 
Join Date: Nov 2008
Location: Memphis, TN
Age: 23
Posts: 436
Magic Hands is on a distinguished road
Send a message via Skype™ to Magic Hands
Default

How are you presenting the modal view? Are you releasing the view after it is presented?
__________________
Magic Hands is offline   Reply With Quote
Old 07-13-2011, 03:55 PM   #3 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

Can you post any code where you are manually adjusting the frames of your subviews?
smithdale87 is offline   Reply With Quote
Old 07-13-2011, 04:16 PM   #4 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default

Thanks for the responses.....

Heres where I am presenting:
Code:
LoginViewController *viewNew = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:[NSBundle mainBundle]];
        self.loginViewController = viewNew;
        loginViewController.modalPresentationStyle = UIModalPresentationFullScreen;
        [self presentModalViewController:self.loginViewController animated:NO];
        [viewNew release];
Here is the code where I am adjusting the position of UI elements (viewWillAppear and shouldAutoRotatetoInterface):

Code:
// setting up the view for when it becomes visible.
    if (([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeRight))
    {
        // position input view and logo image.
        [inputView setFrame:CGRectMake(150, 46, 320, 176)];
        [loginImage setFrame:CGRectMake(18, 69, 124, 130)];
    }
    else
    {
        // position input view and logo image.
        [inputView setFrame:CGRectMake(0, 61, 320, 176)];
        [loginImage setFrame:CGRectMake(98, 264, 124, 130)];
    }
wheli is offline   Reply With Quote
Old 07-14-2011, 09:55 AM   #5 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default

Any Ideas? I am completely stumped.....
wheli is offline   Reply With Quote
Old 07-14-2011, 10:14 AM   #6 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

You could try setting the autoResizesSubviews property to NO, and/or perhaps setting the autoresizingmask property to UIViewAutoresizingNone
smithdale87 is offline   Reply With Quote
Old 07-14-2011, 10:58 AM   #7 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default

I already had the autoresizing turned off.
I just tried adding [self.view setAutoresizingMask:UIViewAutoresizingNone]; to viewDidLoad and viewWillAppear, and it doesn't seem to make any difference.

Thanks for the suggestion though.
wheli is offline   Reply With Quote
Old 07-15-2011, 01:03 PM   #8 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default

So I made a small bit of progress on this issue. If i add the following lines of code, I no longer see the issue, BUT I want to keep the status bar visible in my app, so I can't use this as a fix.

Code:
- (void)viewDidAppear:(BOOL)animated
{
   [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
}
It looks like status bar is causing the issue, but I am still not sure how to fix it...
wheli is offline   Reply With Quote
Old 07-15-2011, 01:31 PM   #9 (permalink)
Registered Member
 
wheli's Avatar
 
Join Date: Jan 2010
Posts: 130
wheli is on a distinguished road
Default

I was able to solve my problem by hiding the status bar before presenting the modal view and then reshowing it.

objective c - IPhone - After dismissing Modal View Controller - gap is left at top of page - Stack Overflow

Thanks anyway for the help guys.
wheli is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 371
9 members and 362 guests
apatsufas, chemistry, Kirkout, leostc, lzwasyc, MarkC, Sami Gh, SamorodovAlex, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:39 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0