开发者

Setting bounds for UIActionSheet?

I have a UIActionSheet and would like to adjust (increase) its width to accommodate the text of the buttons that it contains. The width of these buttons is determined at runtime and could change during runtime.

I开发者_JAVA百科 have mucked around with [[actionSheet superview] superview] to get the containing UIPopoverView, but changing its frame doesn't yield desired results. And, mostly, this just seems an extremely fragile way to go.

I tried [actionSheet sizeToFit] without any noticeable effect.

So, I am hoping that I have overlooked some obvious method for adjusting the size of the UIActionSheet/UIPopoverView.

Thanks.


It doesn't work, as you have probably figured out. The common solution is to create a custom UIViewController and display it using UIViewController's presentModalViewController, which can give you a nice slide up transition, much like how a UIActionSheet appears.

But that solution is missing something. A UIActionSheet slides up, but not all the way, leaving a semi-transparent covering over the parent view. There is a brilliant detailed tutorial with code and project which will try to show you how to display a custom view with this same effect.

http://www.nearinfinity.com/blogs/andrew_homeyer/display_a_custom_uiview_like_a.html I wish i made this tutorial before this guy made it! he got there before me

PK


That can be done easily.

actionSheet.frame = cgrectmake(0,0,200,300);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜