开发者

UIScrollView "view" property

In the documentation, UIScrollView inherits from UIView. If that is true, why doesn't UIScrollView have a view property? As in

self.scrollView.view addSubview

I get the error that view is not a property of UIScrollView. I开发者_如何学Python thought if you inherit from a superclass you get those properties as well? Sorry for the noob question... Thanks.


To add a subview to an UISCrollView you just have to do:

[self.scrollView addSubview:view];


As it's inherited from UIView So it's itself an UIView.

[myScrollView addSubview:myView];


This is primarily because UIScrollView is itself a view. So calling self.scrollView.view would be the same as calling self.view.view on a view controller

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜