0

created table view progamatically...

 attatchmentTableView=[[UITableView alloc]initWithFrame:CGRectMake(attatchmentsLabel.frame.origin.x+200, attatchmentsLabel.frame.origin.y-20, issueHistoryTextView.frame.size.width, 100) ]; 

    attatchmentTableView.scrollEnabled=YES;
    //attatchmentTableView.userInteractionEnabled=YES;
    attatchmentTableView.layer.borderColor = [UIColor purpleColor].CGColor;
    attatchmentTableView.allowsSelectionDuringEditing=YES;
    attatchmentTableView.layer.cornerRadius = 10.0f;
    attatchmentTableView.allowsSelection=YES;
    attatchmentTableView.layer.cornerRadius=4;
    attatchmentTableView.layer.borderWidth=3.0f;
    attatchmentTableView.delegate=self;
    attatchmentTableView.dataSource=self;
   [createIssueView addSubview:attatchmentTableView];

and impletemented table view datasource and delegate methods, but unable to call didSelectRowAtIndexPath method.

So any one can help in this issuance..Thanks in advance

vaibhav
  • 4,038
  • 1
  • 21
  • 51
Shaik Tamim
  • 95
  • 12

2 Answers2

2

Probably it is useless, but just try to add userinteractionenabled = true. Or try bringSubviewToFront. Do you have other tableView or GestureRecongnizer?

UPDATE

When the tableView:didSelectRowAtIndexPath method is not called, there many things you can check:

  • UITableViewDelegate correctly set
  • Single Selection not enabled
  • Other gesture UIGestureRecongnizer in the same controller

In this last case, the solution depends on what you need. The fastest solution is to enable both simultaneously with this code:

yourGestureRecognizer.cancelsTouchesInView = false;

Otherwise, take a look at the UIGestureRecognizerDelegate.

Zeb
  • 1,715
  • 22
  • 34
  • 1
    Try with `yourGestureRecognizer.cancelsTouchesInView = false;` – Zeb Oct 12 '16 at 10:22
  • `cancelsTouchesInView = false` makes `didselect` method to execute after GestureRecognizer ? – vaibhav Oct 12 '16 at 10:47
  • Another issue i am facing since long time...Drawing dual y-axis bar grouped bar charts..can you please help me in this issue..Thanks in advance – Shaik Tamim Oct 12 '16 at 10:48
  • @vaibhav Yes, usually the GestureRecognizer is executed before the `didSelectRowAtIndexPath` – Zeb Oct 12 '16 at 10:50
  • @ShaikTamim I'm not understanding your second question, please consider to create a new question here in SO! – Zeb Oct 12 '16 at 10:51
0

Remove these two lines and try again:

attatchmentTableView.allowsSelectionDuringEditing=YES;
attatchmentTableView.allowsSelection=YES;
Hexaholic
  • 3,299
  • 7
  • 30
  • 39
User511
  • 1,456
  • 10
  • 28