我是Objective-C的新手,並且編碼全部。我已經開始創建一個應用程序,將圖片從屏幕上部拉到屏幕底部,並在底部釋放聲音。當imageView被移動時觸發聲音
#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座標來做聲音效果並以這種方式觸發聲音。但我現在不知道如何編碼。
我不明白如何使用此代碼。如上所述,這裏總是新手。 –