开发者

Design views in IB and use them few times with different content?

开发者 https://www.devze.com 2022-12-27 17:59 出处:网络
is it possible to design a view in interfacebuilder and use it dynamically a few times? the view structu开发者_JAVA技巧re is

is it possible to design a view in interfacebuilder and use it dynamically a few times?

the view structu开发者_JAVA技巧re is

- UIScrollView
  - UIView
    - UIImageView
    - UILabel

now i want to dynamically create multiple instances of the UIView in a for loop with different UILabels and UIImageViews. I want to give them side-by-side in the imageview.

thanks + regards


Sure. Just call:

[[NSBundle mainBundle] loadNibNamed:@"myNibName" owner:self options:nil];

It returns an array that contains all top-level objects you have placed in the NIB file. You can then assign those objects to any of your instance variables/properties. See the documentation for details.

0

精彩评论

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