开发者

iPhone Interface Builder make a view a subView

I have a UIView and a UITableView in the same NIB file like so:

iPhone Interface Builder make a view a subView

I have realised that I can't add a toolbar or anything to this because it has to be a subview to a UIView first. At the current point in time this is merely a separate UITableView. How do I turn it into a subview开发者_开发知识库 of the UIView?

Also, if I can't do that, how do I add a new UITableView as a subview of the UIView? I have tried to do so as well and I ended up with the following error:

iPhone Interface Builder make a view a subView

I don't quite know how to add the view outlet as simply dragging the view towards the file's owner does not allow me to do so.

Any help would be much appreciated, thanks in advance.


The easiest way to make a view a subView is by doing it like in the second screenshot. What you are missing is that you need to create a UITableViewController and then in Interface Builder you set the "File Owner" class with the name of your controller in the Identity Inspector. Then you can set the view property to that UITableView.

iPhone Interface Builder make a view a subView

Notice the Custom class of File's Owner

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜