iOS: setting Exclusive Touch to all buttons in a view

后端 未结 8 502
灰色年华
灰色年华 2021-01-03 16:17

My app has many buttons in a Window and I want to set Exclusive Touch all of them together. Do you have any suggestion about this? Thanks

8条回答
  •  没有蜡笔的小新
    2021-01-03 17:13

    Are you just looking for an easy way to set them all at once?

    If you have all the buttons in an array (e.g. they're all connected to the same IBOutletCollection) you can use key value coding to set the exclusiveTouch property of the array:

    [buttonArray setValue:[NSNumber numberWithBool:YES] forKey:@"exclusiveTouch"];
    

    NSArray will then invoke the same method on every item in the array.

提交回复
热议问题