bennyguitar / CollapseClick

A collapsible list that functions like a UITableView, except you can collapse and open cells on a click. Feed it UIViews for what is shown when each cell is open. Works via delegation similar to UITableView.
MIT License
533 stars 83 forks source link

Multiple view's #12

Open ilia3546 opened 11 years ago

ilia3546 commented 11 years ago

If you add one view multiple times, then the view will appear only in the last item Example: -(int)numberOfCellsForCollapseClick {return 3;} -(UIView *)viewForCollapseClickContentViewAtIndex:(int)index {return imageView;} We add one view 3 times, but view will appear only in the last CollapseClickCell

bennyguitar commented 11 years ago

This happens because you are using an instance variable or property of the class, and each view that goes into the CollapseClick needs to be a separate alloc'd and init'd view.

ilia3546 commented 11 years ago

I'm solve this problem by create multiple copy of view

shyamsundar1988 commented 10 years ago

Hi ilia3546, Can you explain in detail how did you solve this problem... Coz this is driving me crazy... If you share some code that would be helpful.. Thank you.

Especially when i use a tableview, the data source and delegate methods are not being called

VaibhaviOSGeek commented 9 years ago
 -(UIView *)viewForCollapseClickContentViewAtIndex:(int)index 
 {

 UIView *vw;
  for (int i=1; i<3; i++)// could be your array
 {
   vw=[[UIView alloc]initWithFrame:CGRectMake(10, 5, 300, 100)];
   vw.backgroundColor=[UIColor blueColor];
 }
return vw;
}

ilia3546 this might helps you.. I'm not sure..about it :-)