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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 09-30-2008, 12:14 PM   #11 (permalink)
cope784
New Member
 
Join Date: Jun 2008
Posts: 22
Default

Jume,

We were able to get working. Here is what we did:

First in the interface (this is only partial b/c of company policies i can't show you everything):
Code:
@interface YourViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
	UITableView	*myTableView;
	CGAffineTransform _originalTransform;
	CGRect _originalBounds;
	CGPoint _originalCenter;
}

@property (nonatomic, retain) UITableView *myTableView;

@end
Next here is the implementation:
Code:
@implementation YourViewController

@synthesize myTableView;

- (void)loadView {
	
	UIView *viewContainer = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];

	CGRect tableFrame;
	tableFrame.origin.x += 10;
	tableFrame.origin.y -= 15;
	tableFrame.size.height = 320;
	tableFrame.size.width = 460;
	
	// create and configure the table view
	myTableView = [[UITableView alloc] initWithFrame:tableFrame style:UITableViewStylePlain];
	
	myTableView.delegate = self;
	myTableView.dataSource = self;
	myTableView.autoresizesSubviews = YES;
	myTableView.scrollEnabled = YES;	
	myTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

	
	[viewContainer addSubview:myTableView];
	self.view = viewContainer;	
}

- (void)viewWillAppear:(BOOL)animated {
	
	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
	
	_originalTransform = [[appDelegate navController].view transform];
	_originalBounds = [[appDelegate navController].view bounds];
	_originalCenter = [[appDelegate navController].view center];
	
	CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
	landscapeTransform = CGAffineTransformTranslate (landscapeTransform, +80.0, +100.0);
	
	[[appDelegate navController].view setTransform:landscapeTransform];
	
	[appDelegate navController].view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
	[appDelegate navController].view.bounds  = CGRectMake(0.0, 0.0, 480.0, 320.0);
	[appDelegate navController].view.center  = CGPointMake (240.0, 160.0);
	
	[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
}

- (void) viewWillDisappear:(BOOL)animated {
	
	AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
	[[appDelegate navController].view setTransform:_originalTransform];
	[[appDelegate navController].view setBounds:_originalBounds];
	[[appDelegate navController].view setCenter:_originalCenter];
	
	[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait; 
}
As you can see we are manually transforming the views and restoring the correct views. There is one problem interface bug when you leave this view, but nothing major.

Last edited by cope784; 10-09-2008 at 04:22 PM.
cope784 is offline   Reply With Quote
 

» Advertisements
» Online Users: 262
18 members and 244 guests
ADY, apatsufas, BdR, ckgni, F_Bryant, Guthook, ilmman, joeallenpro, ketaskin, michelle, Music Man, NSeven, smethorst, Sunny46, themathminister, TheWebWizz, zbynda, ziocleto
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,710
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:12 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.