On 17.01.2012 19:39, chris maley wrote:
thanks rob

I'm creating the cell here

   public override UITableViewCell GetCell (UITableView tableView,
NSIndexPath indexPath)
             {
                 UITableViewCell cell = tableView.DequeueReusableCell
(kCellIdentifier);
                                
                 if (cell == null)
                 {

You must create a cell here:

                     cell = new AccessibilityExtensions
(UITableViewCellStyle.Default, kCellIdentifier);
                 }
                                
                 cell.TextLabel.Text = list[indexPath.Row].Name;
                                cell.Accessory = 
UITableViewCellAccessory.DisclosureIndicator;

                                cell.SetAccessibilityLabel("text");


                                //UITableViewCell cell1 =  new 
AccessibilityExtensions();
                        
                 return cell;
             }

is this where i would call the extension?

AccessibilityExtensions is a C# extension class. You can't create instances from it.

Add the attached file to your project, and whenever you want to
set an accessibility label to a UIView descendant, you just
invoke the extension method on the instance.

Robert
using System;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;

	public static class AccessibilityExtensions
	{
		static Selector selAccessibilityLabel = new Selector("accessibilityLabel");
		static Selector selSetAccessibilityLabel = new Selector("setAccessibilityLabel:");
		
		public static string GetAccessibilityLabel(this UIView view)
		{
			if (view == null)
				throw new ArgumentNullException("view");
			
			if (view.RespondsToSelector(selAccessibilityLabel))
				return new NSString(Messaging.IntPtr_objc_msgSend(view.Handle, selAccessibilityLabel.Handle));
			else
				return null;
		}
		
		public static void SetAccessibilityLabel(this UIView view, string text)
		{
			if (view == null)
				throw new ArgumentNullException("view");
			
			if (text == null)
				throw new ArgumentNullException("text");
			
			if (view.RespondsToSelector(selSetAccessibilityLabel))
				Messaging.void_objc_msgSend_intptr(view.Handle, selSetAccessibilityLabel.Handle,
					new NSString(text).Handle);
		}
	}
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to