[MonoTouch] UIActionSheet 'Presenting action sheet clipped by its superview' warning

Dan mt_forums at ibase.plus.com
Wed Oct 12 07:16:30 EDT 2011


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.


More information about the MonoTouch mailing list