I have category for UIScrollView
for customization
I need get UIScrollView
.
I try
UIScrollView *scroll = nil;
for (UIView* subview in self.tableView.subviews) {
NSLog(@"%i", self.tableView.subviews.count);
if ([subview isKindOfClass:[UIScrollView class]]) {
scroll = (UIScrollView *)subview;
//some code
}
}
But it doesn't work. How I can get ScrollView
? Thanks
UITableView
is a subclass of UIScrollView
, not a subview (or vice-versa as your code tries), so you should just use the table view directly.
UIScrollView is not subview but UIScrollView is superclass of UITableView you can call method or get variable of UIScrollView by through UIScrollView, If you want to get UIScrollView you can use by this
var scroll = self.tableView as UIScrollView
//some code
Or you want to compare you can use
if scrollView == self.tableView {
//some code
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With