English 中文(简体)
多语种和视听
原标题:multiTouch and audio

我有一些多方面的问题。

这是我法典的一部分。

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint pt = [touch locationInView:self.view];

if(pt.x>634 && pt.x<733 && pt.y >64 && pt.y<145)
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"si" ofType:@"mp3"];
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];
}

if(pt.x>634 && pt.x<733 && pt.y >195 && pt.y<276)
{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"la" ofType:@"mp3"];
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];
}


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
    NSString *path = [[NSBundle mainBundle] pathForResource:@"rest" ofType:@"mp3"];
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];
}

我希望这能够奏效。

实际上,第二个“如果(安排)和计划;和(安排)”“部分工作”。 谁能告诉我解决办法?

第一个范围的工作,我希望第二个范围能够发挥“作用3”的作用,但当2个手.倒时,它就没有做任何音乐。

最佳回答

由于我无法删除最后的答案,因此,这项工作将是完整的答案。 我做了一个重大的读写错误,我需要写新的答案。 您不得使用<条码>[指任何目标],因为这不会可靠地给你在多图体系中的希望。

您必须使用<条码>[所有物体]标注AtIndex:#],以提取电线。 这些接触点将按起步。

问题回答

你们需要重新阅读关于多邮袋活动的文件。 首先,你们需要将这种观点的多种动产交给YES。 第二,在你重新定位时,你每次只重开一次触动会。

UITouch *touch = [touches anyObject];   

相反的尝试

for (UITouch * touch in touches) {

- 在执行本套中每一条内容的法典。

第二,我担心你的AVAudioPlayer将在IntelDid Begin公司终止后获释;我认为这将取消其余的挫折。 这很可能是一种财产。 此外,AVAudioPlayer只能同时发挥一个音频轨道,因此,你希望有两个不同的线hang。

另一种(更优惠的)选择是完全割礼和公正使用 but子。 通知你,当一个州被压倒(从照会起)时,当一个州被放出时(控制着哪一个州仍然倒塌的轨道,如果你在最后一个州退下,那么就“逮捕。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签