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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-12-2011, 12:54 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 45
ronm3xico is on a distinguished road
Unhappy UITableViewController not resizing

I have a UITableViewController subclass that I created to display a table of players. I want to resize it when you rotate (since I create it programmatically), I was going to map it's coordinates, such as self.view.frame = CGRectMake(x, y, width, height) but that doesn't seem to be working. When I print out self.view.frame it prints out (null).

My initialize code for the controller looks like so:
Code:
- (id)initWithStyle:(UITableViewStyle)style {
    self = [super initWithStyle:style];
    if (self) 
	{
		dataSource = [[NSMutableArray alloc]init];		
		tableData = [[NSMutableArray alloc]init];
		
                //Other unrelated stuff here
		
		[tableData addObjectsFromArray:dataSource];

		self.view.frame = CGRectMake(0, 44, 480, 368);
		
		topBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 480, 44)];
		topBar.tintColor = [UIColor blackColor];
		[topBar setItems:[NSArray arrayWithObject:[[UIBarButtonItem alloc]
	initWithBarButtonSystemItem:UIBarButtonSystemItemEdit
        target:self action:@selector(editTable:)]]];
	}
    return self;
}
The code that I have in the willRotateToInterfaceOrientation looks like so

Code:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
	if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
	{
		self.view.frame = CGRectMake(0, 44, 480, 226);
	}
	else 
	{
		self.view.frame = CGRectMake(0, 44, 480, 336);
	}
        NSLog(@"%@", self.view.frame);
        //This prints out (null)
}
Does anyone know why the frame would be null, and not properly resizing? I get a really small tableView (the tableView that looks like it is on top in the picture) over my other tableView that is below the subview, on another ViewController? It's clearly not 226 in height, which makes sense if the frame it's trying to manipulate is null, but I can't figure out why it would be.

Thanks a lot,
Joe

Last edited by ronm3xico; 01-12-2011 at 12:55 AM. Reason: Forgot to attach image
ronm3xico is offline   Reply With Quote
Old 03-11-2011, 12:17 AM   #2 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 1
JRTrue is on a distinguished road
Default NSLog Printing NULL

Joe,

I cannot answer your question directly, but I can tell you why your NSLog is printing NULL (I am having a similar problem, but with the height of the UITableView, so I feel your pain). The CGRect (self.view.frame) cannot print out as a string.

Change the %@ to %f. Then change self.view.frame.size to self.view.frame.size.height. This will allow you to see the height, repeat for the width.

Hope this helps a little.

Happy debugging,
Jake
JRTrue is offline   Reply With Quote
Reply

Bookmarks

Tags
resizing, size, uitableview, uitableview problem, uitableviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 362
9 members and 353 guests
7twenty7, blueorb, iAppDeveloper, iGamesDev, Mah6447, Morrisone, mottdog, sacha1996, Touchmint
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,667
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, host number one
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:36 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0