Discussion Forums  >  WebViews and HTML for Mobile

Replies: 6    Views: 276

Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
03/29/13 07:11 AM (11 years ago)

Layout problem in Landscape view

Hi, Has anybody come across this particular problem and found a solution for it? (I'm developing an app using v1.5 for iOS) I have a menu list screen without a navigation bar which links to an RSS screen with a navigation bar. Both the screens look good in portrait mode. When the RSS screen is rotated from portrait to landscape the navigation bar shrinks in height (on the iPhone, not iPad), and returns back to 44 pixel high in portrait. However when I load the same menu list in landscape mode a strange bug occurs: 1: The menu list displays correctly, but the subsequent RSS screen table layout is offset to the right and part of the right side of the table disappears offscreen. 2: Also the navigation bar starts at 44 pixels high, but should be narrower (as we are on in Landscape mode on iPhone). - If the screen is then rotated to portrait and back to landscape the navigation bar shrinks to the narrower size! Can anyone give me a heads up as to how to fix this?
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
03/29/13 07:33 AM (11 years ago)
An idea: The BT1.5 code is no longer supported, thus you may see some issues. If you run a self hosted V2.0 server, you can get all the same features back. V2.0 may have fixed this problem. Jake
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
03/29/13 08:00 AM (11 years ago)
Hi Jake, i was hoping to avoid going the self hosted route as it'll add another few weeks to the development time, but guess this will have to be the way if I can't get a reply from another forum member Thanks for the suggestion though
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
03/29/13 11:51 AM (11 years ago)
Just had a go on a v2.0 app - seems to be similar problems with the resizing of the navbar height from Landscape to Portrait displacing the viewport below and creating a useless gap. So have figured out an interim 1.5 fix for those who might be interested - works on BT_screen_rssReader Comment out this // self.myTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; ad then add this code [self.myTableView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin]; this shrinks the width of the table in landscape to be the same as that in Portrait mode. The margins are wider than I'd like, but works ok
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
03/29/13 12:04 PM (11 years ago)
Just figure out another tweak so that the landscape Table view for iPad isn't resized smaller s this didn't display a problem, just the iPhone: //build the table that holds the menu items. self.myTableView = [BT_viewUtilities getTableViewForScreen:[self screenData]]; if([appDelegate.rootApp.rootDevice isIPad]){ self.myTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; }else{ [self.myTableView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight]; } [self.myTableView setDataSource:self]; [self.myTableView setDelegate:self];
 
Jake Chasan
Veteran developer
Profile
Posts: 1685
Reg: May 13, 2011
location unknow...
29,650
like
03/29/13 12:46 PM (11 years ago)
Very Cool. I am glad you figured it out. Jake
 
Rohan
Veteran developer
Profile
Posts: 79
Reg: Mar 12, 2011
London
10,040
like
03/29/13 05:19 PM (11 years ago)
Hey Thanks Jake, been working on the code some more and now fixed it so the width of the landscape table is wide with margin on both left and right hand sides: //build the table that holds the menu items. self.myTableView = [BT_viewUtilities getTableViewForScreen:[self screenData]]; if ([appDelegate.rootApp.rootDevice isIPad]) { self.myTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; } else if (UIDeviceOrientationIsPortrait(self.interfaceOrientation)) { [self.myTableView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight]; } else if (UIDeviceOrientationIsLandscape(self.interfaceOrientation)) { [self.myTableView setFrame: CGRectMake (0, 10, self.myTableView.frame.size.width -20, self.myTableView.frame.size.height)]; } // offset 20 pixels left, 10 from top [self.myTableView setDataSource:self]; [self.myTableView setDelegate:self];
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.