Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
1 つのボタンを 2 つのアクションで作成する必要があります。タッチダウンを使用してサウンドを再生し、内側をタッチアップして、ボタンを離したときにサウンドの再生を停止します。
これらの両方のアクションに 2 つのメソッドを接続します。
[self.yourBtn addTarget:self action:@selector(touchDownMethod:) forControlEvents:UIControlEventTouchDown]; [self.yourBtn addTarget:self action:@selector(touchUpInsideMethod:) forControlEvents:UIControlEventTouchUpInside];