基本上我想创建48个按钮插座。我在界面生成器中创建了按钮,我希望能够将它们连接到插座。IBOutlet阵列声明
当我按下其中一个按钮时,我需要能够播放声音。但播放的声音文件应该是可定制的。
我想水木清华这样的:
//first create the outlets
for(int i=1;i<49;i++){
IBOutlet UIButton [Nstring of type (@"but%d"), i];
[add butt"i" to array];
}
//然后出口连接到按钮
//listen for buttons pressed
while(1){ //or the listener equivalent don't know exactly how i works
for(int i=1;i<49;i++){
if(array[i].pressed==TRUE){
//if button is pressed play the according file
playsound(sounds[i]);
}
}
}
我需要能够很容易地改变播放 文件谢谢
这可能会帮助你 - https://stackoverflow.com/questions/46731185/how-to-connect-3-uibutton-to-one-outlet所有的 – Krunal 2017-10-13 14:06:24