extension methods are part of C#, not specific to MonoTouch.  There are
several great overviews on MSDN and elsewhere you might want to read

As the name implies, they extend an existing class my adding methods to
them.  In this case, the class that is being extended is UIView.  So any
object that is an instance of UIView (like a UITableViewCell) should have
the new method added to it.

in your example, you want to call

cell.SetAccessibilityLabel("text");


On Tue, Jan 17, 2012 at 2:23 PM, chris maley <[email protected]>wrote:

> i tried this but it didn't worked
>
>  public override UITableViewCell GetCell (UITableView tableView,
> NSIndexPath indexPath)
>
>             {
>
>                UITableViewCell cell = tableView.DequeueReusableCell
> (kCellIdentifier);
>
> //UITableViewCell cell;
>
> //cell.SetEditing;
>
>                 if (cell == null)
>
>                 {
>
>                     cell = new UITableViewCell
> (UITableViewCellStyle.Default, kCellIdentifier);
>
>                 }
>
>                 cell.TextLabel.Text = list[indexPath.Row].name;
>
> cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
>
> AccessibilityExtensions.SetAccessibilityLabel(tableView, "test");
>
>                 return cell;
>
>             }
>
>
>
>
> On Tue, Jan 17, 2012 at 3:19 PM, chris maley 
> <[email protected]>wrote:
>
>> again rob
>>
>> thank you for your time. Im a monotouch newbie.
>>
>> the issue I'm having is how do you invoke the extension?
>>
>> On Tue, Jan 17, 2012 at 2:58 PM, Robert Jordan [via MonoTouch] <[hidden
>> email] <http://user/SendEmail.jtp?type=node&node=4304605&i=0>> wrote:
>>
>>> 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
>>>
>>> _______________________________________________
>>> MonoTouch mailing list
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4304557&i=0>
>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>>
>>> *AccessibilityExtensions.cs* (1K) Download 
>>> Attachment<http://attachment/4304557/0/AccessibilityExtensions.cs>
>>>
>>>
>>> ------------------------------
>>>  If you reply to this email, your message will be added to the
>>> discussion below:
>>>
>>> http://monotouch.2284126.n4.nabble.com/monotouch-uitableview-and-accessibility-tp4303857p4304557.html
>>>  To unsubscribe from monotouch uitableview and accessibility, click here
>>> .
>>> NAML<http://monotouch.2284126.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>>
>> --
>> Chris Maley
>> CIO & Co-Founder
>> The 20/200 Project
>> The20200Project.com
>> (P) 613-899-0791
>>
>>
>> ------------------------------
>> View this message in context: Re: monotouch uitableview and 
>> accessibility<http://monotouch.2284126.n4.nabble.com/monotouch-uitableview-and-accessibility-tp4303857p4304605.html>
>>
>> Sent from the MonoTouch mailing list 
>> archive<http://monotouch.2284126.n4.nabble.com/>at Nabble.com.
>>
>> _______________________________________________
>> MonoTouch mailing list
>> [email protected]
>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>>
>
>
> --
> Chris Maley
> CIO & Co-Founder
> The 20/200 Project
> The20200Project.com
> (P) 613-899-0791
>
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to