I want to know how can I get all sub views of any UITableview
cell.
So please suggest any suitable answer.
Thank you.
Asked
Active
Viewed 61 times
1

ajeet sharma
- 803
- 10
- 37
5 Answers
0
This is it : getting for tableView SubViews.
int sections = [self.tableView numberOfSections];// Only for the 1 row with many Sections && if many Rows then //[self.tableView numberOfRowsInSections:sections];
for (int i=0; i<sections; i++) {
NSIndexPath *myIP = [NSIndexPath indexPathForRow:0 inSection:i] ;
UITableViewCell *cell =[self.tableView cellForRowAtIndexPath:myIP];
NSArray *subviews = cell.contentView.subviews;//For perticular cell
for(id element in subviews) {
//if ([element isKindOfClass:[UITextView class]]){}
}
}

Kumar KL
- 15,315
- 9
- 38
- 60
0
Assuming cell
is your UITableViewCell
for(int i = 0; i < cell.contentView.subviews.count; i++)
{
NSString *className = NSStringFromClass([[cell.contentView.subviews objectAtIndex:i] class]);
}

MuhammadBassio
- 1,590
- 10
- 13
0
for(UIView *subView in cell.contentView.subviews)
{
// Get all subView
if([subView isKindOfClass:[UITextField class]]) // here you can set any class name which you need to get it.
{
// Get specific class from subView
}
}

iPatel
- 46,010
- 16
- 115
- 137