Monotouch.Dialog: table rows not selectable in edit mode

classic Classic list List threaded Threaded
3 messages Options
Xy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Monotouch.Dialog: table rows not selectable in edit mode

Xy
When a DialogViewController table is in edit mode, the rows are not selectable:


The delete buttons still work fine. Below is the test code:

using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;

namespace SharePoint
{
	public partial class TestViewController : DialogViewController
	{
		public TestViewController () : base (UITableViewStyle.Grouped, null)
		{
			Root = new RootElement ("TestViewController") {
				new MonoTouch.Dialog.Section ("First Section") {
					new StringElement ("Hello", () => {
						if (TableView.Editing) {
							new UIAlertView ("Edit", "This can be edited!", null, "Continue").Show (); 
						}
						else {
							new UIAlertView ("Hola", "Thanks for tapping!", null, "Continue").Show (); 
						}
					})
				}
			};
		}

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			NavigationItem.LeftBarButtonItem = this.EditButtonItem;
		}

		public override void SetEditing (bool editing, bool animated)
		{
			base.SetEditing (editing, animated);

			TableView.Editing = editing;
		}

		public override Source CreateSizingSource (bool unevenRows)
		{
			return new TestSource(this);
		}

		class TestSource : DialogViewController.SizingSource {

			public TestSource(DialogViewController container)
			: base (container)
			{}

			public override bool CanEditRow (UITableView tableView, NSIndexPath indexPath)
			{
				return true;
			}

			/**
			 * Shows that this is not called in edit mode
			 */
			public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
			{
				base.RowSelected (tableView, indexPath);
			}
		}
	}
}

RowSelected() above is not called in edit mode. How do I fix this or work around it?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monotouch.Dialog: table rows not selectable in edit mode

Craig Dunn-2
This isn't related to MonoTouch.Dialog -- when a table is in edit mode the row isn't selectable (only 'editing' actions can occur).

See this sample which uses UITableView directly (not MonoTouch.Dialog).


I'm not sure you should work around it - this is the way Apple wants to... to select a row, exit from 'edit mode'






On Wed, Aug 21, 2013 at 11:49 PM, Xy <[hidden email]> wrote:
When a DialogViewController table is in edit mode, the rows are not
selectable:
<http://monotouch.2284126.n4.nabble.com/file/n4658436/iOS_Simulator_Screen_shot_Aug_21%2C_2013_11.43.31_PM.png>

The delete buttons still work fine. Below is the test code:


RowSelected() above is not called in edit mode. How do I fix this or work
around it?



--
View this message in context: http://monotouch.2284126.n4.nabble.com/Monotouch-Dialog-table-rows-not-selectable-in-edit-mode-tp4658436.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch


_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
Xy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Monotouch.Dialog: table rows not selectable in edit mode

Xy
Oops, actually I forgot that I should just set AllowsSelectionDuringEditing to true for the TableView.
Loading...