Unity.Platform.IPhone.IPhoneNotification.ShowActionSheet C# (CSharp) Method

ShowActionSheet() private method

private ShowActionSheet ( object sheet ) : void
sheet object
return void
		private void ShowActionSheet (object sheet)
		{
			ActionSheet actionSheet = (ActionSheet) sheet;
			UIApplication.SharedApplication.InvokeOnMainThread (delegate { 
				
				if(actionSheet.Title == null) {
					actionSheet.Title = ""; // null value cannot be passed to UIActionSheet constructor.
				}
				
				string cancelButton = null;
				string[] buttons = new string[0];
				
				if(IPhoneUtils.GetInstance().IsIPad()) {
					// For iPad, cancelButton cannot be specified. It has to be included as an "other" button.
					buttons = actionSheet.Buttons;
				} else {
					if(actionSheet.Buttons != null && actionSheet.Buttons.Length>0) {
						buttons = new string[actionSheet.Buttons.Length-1];
						cancelButton = actionSheet.Buttons[0];
						for(int i=1; i< actionSheet.Buttons.Length; i++) {
							buttons[i-1] = actionSheet.Buttons[i];
						}
					} else {
						// default
						cancelButton = "Cancel";
					}
				}
				
				UIActionSheet uiSheet = new UIActionSheet(actionSheet.Title, new ActionSheetDelegate(actionSheet.JsCallbackFunctions), cancelButton, null, buttons);
				uiSheet.ShowInView(IPhoneServiceLocator.CurrentDelegate.MainUIViewController().View);
			});
		}