Q: iOS: Tagging Errors I'm working on an app that behaves like a photo gallery, and I'm implementing the option to have the user delete photos from their gallery. To accomplish this, I decided to place an invisible button over each picture. When the user hits an "Edit" button, the hidden delete buttons over each picture become active. I'm using the same IBOutlet over each of the hidden buttons for simplicity, and I've tagged each button appropriately in Interface Builder. When the user taps the button over the picture, an alert view appears asking if they really want to delete it. If they click yes, I call removeObjectAtIndex. Here is the code I'm using:
- (IBAction)deleteButtonPressed:(id)sender {
    UIAlertView *deleteAlertView = [[UIAlertView alloc] initWithTitle:@"Delete"
                                                              message:@"Are you sure you want to delete this photo?"
                                                             delegate:self
                                                    cancelButtonTitle:@"Yes"
                                                    otherButtonTitles:@"No", nil];
    [deleteAlertView show];
    int imageIndex = sender.tag;
    deleteAlertView.tag = imageIndex;

}

- (void)deleteAlertView:(UIAlertView *)deleteButtonPressed
       didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if (buttonIndex != [deleteButtonPressed cancelButtonIndex]) {

        [array removeObjectAtIndex:deleteButtonPressed.tag];

    }
  [self.user setObject:array forKey:@"images"];
}

The error that I'm getting is highlighting int imageIndex = sender.tag;, and states "Property tag not found for object of type __strong id". I've been doing research regarding this error, and am not finding any helpful information. I'm still new to programming, so I'm not sure how to fix this at all. Any help is much appreciated, thank you!

A: You need to cast sender to appropriate type. For instance int imageIndex = ((UIView*)sender).tag;.
