ios - TableView as subview of UIView not appearing when app lunches in landscape mode -


i developing application in created tableview subview 2 rows contains label , textfield take username , password user.

i took this site create kind of want

i replace following line

uiview *contentview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 480)]; 

with

uiview *contentview = [[uiview alloc] initwithframe:[[uiscreen mainscreen] bounds]]; 

and replace

tableview = [[uitableview alloc] initwithframe:cgrectmake(0, 0, 320, 440) style:uitableviewstyleplain]; 

this line

tableview = [[uitableview alloc] initwithframe:cgrectmake(self.contentview.bounds.size.width/ 2 - 300, 0, 600, 300) style:uitableviewstyleplain]; 

this code works fine in portrait mode in landscape mode table view not visible first time , have write code handle view on change in orientation resets view on change in orientation both landscape , portrait

thank in advance..

try use methods in view controller:

-(void) didrotatefrominterfaceorientation:(uiinterfaceorientation);

-(void) willrotatefrominterfaceorientation:(uiinterfaceorientation);

for example:


-(void) didrotatefrominterfaceorientation:(uiinterfaceorientation) {

 self.tableview.frame = cgrectmake(self.contentview.bounds.size.width/ 2 - 300, 0, 600, 300); 

}


hope helps :)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -