How to Get SubView
I have a UIScrollView which has a开发者_Go百科dded viewController.view .How to get subview in scroll view.
Everyone Any ideas?
Thanks
if you want to add your view in scroll view then:
[yourScrollView addSubview:yourSubView];
and if you want to get that view then you can :
if ([yourScrollView subviews])
{
for (UIView *subview in [yourScrollView subviews])
{
if ([subview isKindOfClass:yourClassName])
{
//Code
}
}
}
Since UIScrollView
inherits from UIView
, you can use -addSubview:
.
[yourscrollview subviews]; // This gives you all subviews added
If you want to add subviews then you can use the -addSubview method.
You can get all this info from the documentation.
精彩评论