[MonoTouch] UIActionSheet 'Presenting action sheet clipped by its superview' warning
Nic Wise
nicw at fastchicken.co.nz
Wed Oct 12 09:23:03 EDT 2011
Is MyViewController (the instance) in anything other than the base
window? eg inside a tabview or a toolbar?
If it's just window -> myviewcontroller, you can most likely ignore
it. Also, if you can you use all buttons, esp the bottom ones, then
you should be ok.
the problem arrises if you have a view who's parent is a tabbar
controller, and you use the view to show a sheet. Usually, the tab bar
area (bottom 40-odd pixels I think) block the action sheet, so you
can't touch the bottom buttons, even tho they appear on top of the tab
bar.
On Wed, Oct 12, 2011 at 12:16, Dan <mt_forums at ibase.plus.com> wrote:
> Hi,
>
> I'm just getting started with MonoTouch and I'm having a go at using the
> UIActionSheet. I can get it to do largely what I want it to, but whenever
> UIActionSheet.ShowInView() gets called, the application outputs this
> warning:
>
> "Presenting action sheet clipped by its superview. Some controls might not
> respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or
> -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:]."
>
> Have had a try playing around with the Frame and Bounds property of the
> UIActionSheet, but to no avail.
>
> I've copied the relevant code below. Basically it's a UIViewController set
> up in Interface Builder with a single button in it. When the button's
> clicked the UIActionSheet appears. Any help would be much appreciated.
>
> ===========
>
> public partial class MyViewController : UIViewController
> {
> UIActionSheet actionSheet;
>
> #region Constructors
>
> // The IntPtr and initWithCoder constructors are required for items that
> need
> // to be able to be created from a xib rather than from managed code
>
> public MyViewController (IntPtr handle) : base (handle)
> {
> Initialize ();
> }
>
> [Export ("initWithCoder:")]
> public MyViewController (NSCoder coder) : base (coder)
> {
> Initialize ();
> }
>
> public MyViewController () : base ("MyViewController", null)
> {
> Initialize ();
> }
>
> void Initialize ()
> {
> }
>
> #endregion
>
> public override void ViewDidLoad ()
> {
> base.ViewDidLoad ();
>
> showButton.TouchUpInside += showButton_TUI;
> }
>
> class myActionSheetDelegate : UIActionSheetDelegate
> {
> MyViewController uvc;
>
> public myActionSheetDelegate (MyViewController asVc)
> {
> uvc = asVc;
> }
>
> public override void Clicked (UIActionSheet actionSheet, int buttonIndex)
> {
> // ....
> }
> }
>
> protected void showButton_TUI (object sender, EventArgs e)
> {
> if (actionSheet == null)
> {
> actionSheet = new UIActionSheet(
> "My action sheet",
> new myActionSheetDelegate(this),
> "Cancel", null, new string[] {"Button
> 1", "Button 2"});
> }
> actionSheet.ShowInView(this.View);
> }
> }
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/UIActionSheet-Presenting-action-sheet-clipped-by-its-superview-warning-tp3897607p3897607.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>
--
Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
More information about the MonoTouch
mailing list