Question

I want to make a group of cocoa touch objects behave like one object, Is this possible?

For instance, say we had a SuperButton that consisted of two UIButtons, spaced by 10. Let's just say their frame is set.

Is it possible to make a wrapper class ?

that I can init and call -

[_view addSubview:SuperButton] on and have it create both buttons?

I'm not entirely sure on the terminology for what I'm trying to do so it's hard to find any help on google.

Was it helpful?

Solution

Okay, Let me ask you this question first. So you want to create a SuperButton, when ever you call it it should layout the two buttons for you, is this right ?. YES you can do this. Create a new XIB, which is having just a view. configure your buttons in it. Create your super button class and assign it to this xib. You should be able to call this class and it will return view which can be added to your main view controller.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top