I notice when I set MessageTableViewCell accessoryType =UITableViewCellAccessoryDetailDisclosureButton and I tab on the “arrow button” itself, the pop menu that is declared on didSelectRowAtIndexPath: don’t show up??!!! it works fine if I tabbed on the other area of cell, except on the “arrow button” itself,
However, if I used UITableViewCellAccessoryDisclosureIndicator cell accessory type instead, it works fine, even if I tabbed on the arrow itself.
I wonder if this normal behavior, a bug, or I did something wrong.
I prefer UITableViewCellAccessoryDetailDisclosureButton because in my opinion its more clear when you want to get attention of user.
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
static NSString* CellIdentifier = @"MessageCellIdentifier";
MessageTableViewCell* cell = (MessageTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = /*[*/[[MessageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] /*autorelease]*/;
}
CastNearAppDelegate *appDelegate = (CastNearAppDelegate *)[[UIApplication sharedApplication] delegate];
Message* message = [appDelegate.dataModel messageWithID: indexPath.row];
if (!message.isSentByUser)
{
cell.accessoryType =/*UITableViewCellAccessoryDetailDisclosureButton; */UITableViewCellAccessoryDisclosureIndicator;
}else
{
cell.accessoryType = UITableViewCellAccessoryNone;
}
message.bubbleSize = [SpeechBubbleView sizeForText:message.text];
[cell setMessage:message];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIActionSheet *popupQueryOptions = [[UIActionSheet alloc]
initWithTitle:@"Options for Blocking and Spam Reporting"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Block Sender"
otherButtonTitles:/*@"Block Sender",*/
@"Inappropriate Content",
/*@"Tell a Friend via Facebook",
@"Tell a Friend via Twitter",*/
nil];
popupQueryOptions.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[popupQueryOptions showInView:[UIApplication sharedApplication].keyWindow];
}
They are used for different things. The indicator is just an indicator whereas the button allows you to have a different action e.g. acting like a button.
UITableViewhas two possible methods that it will call on it’s delegate when the cell is tapped.When the row itself is tapped the following is called
When you tap on the accessory then the tableView calls
You can also wire these up independently in Interface Builder. So this behaviour is quite deliberate.