Note that there are some explanatory texts on larger screens.

plurals
  1. POif statements regrading to objectforkey button tracking
    primarykey
    data
    text
    <p>I am trying to create an application that allows to you use your data in different ways. Specifically, you can view, copy, edit, and delete the information I am trying to do this using if statements. The issue is, when I build and run, the buttons would not do the action that I want them to do. In particular, I want the "View" button to send the link to Safari, and the "Copy" button to copy the data to the clipboard. The "Edit" button and the "Delete" button does not need to be activated right now.</p> <p>Here's the code for the buttons (under " - (void) viewDidLoad"):</p> <pre><code>buttonData = [[NSArray arrayWithObjects: [NSDictionary dictionaryWithObjectsAndKeys:@"View", @"title", @"view.png", @"image", nil], [NSDictionary dictionaryWithObjectsAndKeys:@"Copy", @"title", @"copy.png", @"image", nil], [NSDictionary dictionaryWithObjectsAndKeys:@"Edit", @"title", @"edit.png", @"image", nil], [NSDictionary dictionaryWithObjectsAndKeys:@"Delete", @"title", @"delete.png", @"image", nil], nil] retain]; buttons = [[NSMutableArray alloc] initWithCapacity:buttonData.count]; </code></pre> <p>And here's the code for the if statements (under " - (IBAction) touchUpInsideAction:(UIButton*)button"):</p> <pre><code>NSIndexPath* indexPath = [tableView indexPathForCell:sideSwipeCell]; NSUInteger index = [buttons indexOfObject:button]; NSDictionary* buttonInfo = [buttonData objectAtIndex:index]; if ([buttonInfo objectForKey:@"View"]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat: @"%@", indexPath.row]]]; } else if ([buttonInfo objectForKey:@"Copy"]) { NSString *message = indexPath.row; [UIPasteboard generalPasteboard].string = message; } </code></pre> <p>If you need to see more code, just tell me; I just thought that these are the only lines of code that you would need to see.</p> <p>I can't seem to find a solution and this is driving me crazy. Could anyone help me? I hope that this doesn't cause too much trouble. Thanks in advance! :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload