objective c - What does @[indexPath] do -
i followed tutorial using uitableview. finished code
- (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if(editingstyle == uitableviewcelleditingstyledelete) { message *message = [messagelist objectatindex:indexpath.row]; [self.persistencyservice deletemessagesfor:message.peer]; [messagelist removeobject:message]; [tableview deleterowsatindexpaths:@[indexpath] withrowanimation:uitableviewrowanimationleft]; } } my question is: @[indexpath] do? same as?:
[nsarray arraywithobject:indexpath]
yes same, short notation defining array. can same nsdictionary , nsnumber well. here samples (and more here):
nsarray *shortnotationarray = @[@"string1", @"string2", @"string3"]; nsdictionary *shortnotationdict = @{@"key1":@"value1", @"key2":@"value2"}; nsnumber *shortnotationnumber = @69;
Comments
Post a Comment