in .h file
@interface DetailViewController : UIViewController < UITableViewDataSource, UITableViewDelegate, UIPopoverControllerDelegate, UISplitViewControllerDelegate>
{
UITableView *myTableView;
}
in .m file
- (void)viewDidLoad
{
CGRect frame = [UIScreen mainScreen].applicationFrame;
myTableView = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
myTableView.delegate= self;
myTableView.dataSource = self;
[self.view addSubview:myTableView];
[super viewDidLoad];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{
// Portrait
CGRect frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.view.frame.size.height);
myTableView.frame = frame;
}
else {
// Landscape
CGRect frame = CGRectMake(0, 0, 703, self.view.frame.size.height);
myTableView.frame = frame;
}
return YES;
}
No comments:
Post a Comment