开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜