2012-11-07 4 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]; 
} 
관련 문제