4

I am creating a tableView with custom cells, with each cell being created with the following code:

UITableViewCell    * cell = [tableView dequeueReusableCellWithIdentifier:kEditSymbolCellId];

I have returntableView.isEditing; set.

and i have the minus button visible from the get go. With the editing style set toUITableViewCellEditingStyleDelete
somewhere (if (editingStyle == UITableViewCellEditingStyleDelete) { passes).

Where would i have to change the code to add the accessibility label.

I am creating the cell of a custom class- the .h has only this in it:

@interface WidgetEditCell : UITableViewCell
@property (retain, nonatomic) IBOutlet UILabel *symbolLabel;
@property (retain, nonatomic) IBOutlet UILabel *subtitleLabel;

With ainitWithStyle and asetSelected in the .m nothing that changes the cursed minus image. someone please help.

s5v
  • 495
  • 5
  • 20
  • Is the minus button in a cell or in a navigation bar? Are you saying that you just want the button to perform a "remove images" or are you saying you want to have a label wherever there is a missing image? I just want to be clear. – App Dev Guy Jun 12 '15 at 12:18
  • I am trying to add accessibility labels to aid in automated calabash testing. with the [cell.obj setAccessibilityLabel:@""]; command. the minus image seems to be added automatically when editing is set to true and editing style is set to UITableViewCellEditingStyleDelete. when i touch the minus button, the cell slides and a red delete button appears. – s5v Jun 12 '15 at 12:21
  • So you just want the minus image to not display? Or you want a label to be present when the minus image displays? – App Dev Guy Jun 12 '15 at 12:28
  • no... the minus image can stay, i just want to add an accessibility label to the image.the label will be invisible. – s5v Jun 12 '15 at 12:32
  • could you show a screen shot of what you have, may have a solution, but want to ensure I am on the same page. – App Dev Guy Jun 12 '15 at 14:20
  • 1
    sorry about the delay, but i cannot post images. but to explain, i have the table, with a small red circle with a - in the middle. when i touch that, i get the delete button on the right edge of the cell. the label i want to add, will be invisible . i will try the method provided by SASmith and will get back to you. – s5v Jun 17 '15 at 11:14
  • which solution worked for you? Just curious :-) – App Dev Guy Jul 23 '15 at 08:53

1 Answers1

3

By default, there should be an accessibilityLabel built in that reads your label and places the message "delete" in front. I have tested a custom cell, see below:

testing accessibilityLabel

If that does not suit your needs, I have these suggestions:

  1. Add a UIAlertView to display a message when a person wishes to delete. This can have a voice message enabled, and, realistically is a pleasant way of going about business providing things aren't being deleted (my opinion).

  2. Create your own custom delete function following this tutorial from Ray Wenderlich. I have used it and find it really practical for customisability.

  3. I have not tried this, but create your accessibilityLabel whenever the edit option is used by creating a custom button, or UILabel that is set to Transparent.

    UIButton *someButton = [[UIButton alloc] initWithFrame:CGRectMake(x, y, h, w)];
    someButton.backgroundColor = [UIColor clearColor];
    someButton.accessibilityLabel = @"SomeNSString";
    

Have it fill the area around the button perhaps and then have it perform the delete function if that's called so it appears seem less. It's probably not the greatest option on the planet but I have yet to see another way.

Image from Ray Wenderlich

Image from Ray Wenderlich

App Dev Guy
  • 5,396
  • 4
  • 31
  • 54
  • 1
    i think i need to clarify myself, before other people take this as the solution. this helped me a lot -but i still have not solved it- am a developer helping the testers build the automation more than a tester- and was shafted over to other dev works that needed done asap. i will probably come back to this in a month, and when i solve it, i will post the answer(hopefully, i will have an asnswer to post :-p) – s5v Jul 23 '15 at 09:54