开发者

How do I create an IBOutlet that is assigned to Multiple UIButtons

I have an IBOutlet assigned in my header file named *myButton and is type UIButton class.

the purpose of myButton is to programmatically assign the alpha to multipl开发者_C百科e buttons.

it seems as if you can only assign myButton to one button in IB.

is there a way to assign an alpha value to multiple buttons at the same time or am i going to have to refer to each button. ive got quite a few buttons and i need them all to change at the same time.

thanks for any help!


An IBOutlet is simply an instance variable (which is a pointer) in your class. You cannot have a pointer refer to more than one memory space simultaneously in any programming language.

You will need to refer to each button individually. You could look into storing pointers to all your buttons in an NSArray and simply iterating over it. You could also look into using an NSMatrixView or NSCollectionView to display your many buttons, and then take action on that to change all your buttons.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜