iOS: problema de TableView y tamaño

I have a UITableViewController class for a simple table view(like a 2-4 cells User ID and Password,... )I represent this table view with "presentModalViewController" and the problem is the table view's width will be fit to whole screen's width and I want to make it smaller and be in a center of screen.I used the "viewWillAppear" and tried to set the self.tableView.frame to a CGRect like (150,150, 500, 600), now there are 2 problems 1) the x and y of new table view is alway( 0,0) the second issue is the frame of tableView has different color than background. how can I fix these?

Gracias, kam

preguntado el 09 de marzo de 12 a las 16:03

I checked if I use viewDidAppear for changing the size it works fine, but i have to find out to make the tableView and bg screen view in the same color. -

1 Respuestas

the problem is the table view's width will be fit to whole screen's width and I want to make it smaller and be in a center of screen

Then don't use a UITableViewController. The docs on UITableViewController clearly say this: if a table doesn't occupy the whole screen, use your own UIViewController subclass instead.

What you want, probably, is a UIViewController whose view will occupy the whole screen, as usual - and that view contains a table view placed in the desired location.

respondido 09 mar '12, 16:03

How about if i want to resize the cells sizes? - Leva

The width of the table the width of the cells. For the height of the cells, read the docs (starting with rowHeight). - mate

Tried your first suggestion(got a viewController and a tableView in it)but still seeing the same behavior... tableView size covers whole screen. - Leva

OK think I had to change the contentView.autoresizesSubviews to NO. Now I have the same issue with bg color and tableView color, how to set them in unique color? - Leva

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.