2012-11-07 13 views
0

如何在我的方法中獲得objectAtIndex如何在我的方法中獲取objectAtIndex?

例如,如果我用didSelectRowAtIndexPath:(NSIndexPath *)indexPath

我可以

NSLog(@"%@", [currentCourses objectAtIndex:indexPath.row]); 

得到它,我怎麼可以這樣做像這樣其他的方法?

-(void)longPress : (UILongPressGestureRecognizer *)rec { 
if (rec.state == UIGestureRecognizerStateBegan) { 
// NSIndexPath *myPath = [NSIndexPath indexPathForRow:0 inSection:0]; 
    /*NSArray *currentCourses = [self currentCourses:myIP0.section]; 
    billContent *bc = [currentCourses objectAtIndex:myIP0.section]; 
    NSLog(@"title - %@", bc.billTitle);*/ 
    // NSLog(@"%@", myPath.row); 

    //NSLog(@"did selected - %d", indexPath.row); 

} 
} 

回答

3
-(void)longPress : (UILongPressGestureRecognizer *)rec { 
CGPoint swipeLocation = [rec locationInView:self.tableView]; 
NSIndexPath *swipedIndexPath = [self.tableView indexPathForRowAtPoint:swipeLocation]; 
UITableViewCell *swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath]; 
} 
相關問題