开发者

iPad: how can I create a repeatable UI element using Interface Builder?

开发者 https://www.devze.com 2023-02-22 08:23 出处:网络
I want to make a panel in Interface Builder with buttons and stuff on it.Then I want to programmatically clone it and reposition the clones with affine transforms.

I want to make a panel in Interface Builder with buttons and stuff on it. Then I want to programmatically clone it and reposition the clones with affine transforms.

I'm thinking of something like开发者_运维问答 a MovieClip from Flash.

iPad: how can I create a repeatable UI element using Interface Builder?

And it isn't sufficient to just render the same UI element multiple times. For example, it should be possible to type something different in each text box.

Any ideas?


  1. Create a new NIB file that contains your custom view.
  2. Create a UINib instance from that NIB file with +[UINib nibWithNibName:bundle:].
  3. Whenever you want to create a new view, call -[UINib instantiateWithOwner:options:]. The array that this method returns contains all top-level objects of your NIB. So if the NIB file you created only consists of a view, the array contains this view as its only element. Make sure to retain the objects in the array.
0

精彩评论

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