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
Post a Comment