Rehan
Rehan

Reputation: 57

How to Get SubView

I have a UIScrollView which has added viewController.view .How to get subview in scroll view.

Everyone Any ideas?

Thanks

Upvotes: 1

Views: 3844

Answers (3)

Maulik
Maulik

Reputation: 19418

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 
            }
        }
    }

Upvotes: 5

Praveen S
Praveen S

Reputation: 10393

[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.

Upvotes: 1

jtbandes
jtbandes

Reputation: 118681

Since UIScrollView inherits from UIView, you can use -addSubview:.

Upvotes: 1

Related Questions