Auto resizing UITableView on rotation with flexible width

I am adding UIButtons to a UIView located on the right side of a split view controller. Without any autoresizing set, the button text fully displays in landscape orientation. When I rotate to portrait orientation, all button text is fully displayed, but there is extra space on the right hand side of the UIView, because there is more real estate to work with.

I would like these buttons to resize on rotation so that it utilizes the entire width. I tried setting:

[button setAutoresizingMask:UIViewAutoresizingFlexibleWidth];

With this in place, the same extra real estate exists on the portrait orientation, but in landscape orientation I get a lot of buttons with the text shortened with "..."

How can this be done?


when the AutoResisingMask doesnt do it for me, I always resort to subclassing the UIView and overriding the layoutSubviews... this way I can manually place those tricky views that never look right in different orientations.

in fact.. at last year's WWDC, I heard an Apple Engineer say that he "always" creates and adds his views with frame CGRectZero, then sets the correct frame in layoutSubviews. For what its worth...

链接地址: http://www.djcxy.com/p/58378.html

上一篇: 在UINavigationController中调整工具栏的大小

下一篇: 使用灵活的宽度自动调整UITableView的旋转大小