我是 Objective-C 和编码的新手。我已经开始创建一个应用程序,将图片从屏幕上部拉到屏幕底部,它应该在底部释放声音。
#import "TestiAppViewController.h"
@interface TestiAppViewController ()
@end
@implementation TestiAppViewController
-(IBAction)controlPan:(UIPanGestureRecognizer *)recognizer {
CGPoint translation = [recognizer translationInView:self.view];
recognizer.view.center = CGPointMake(recognizer.view.center.x, recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointMake(0,0) inView:self.view];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
如果我理解正确,我应该能够通过使用 y 坐标并以这种方式触发声音来制作音效。但我现在不知道如何编码。