English 中文(简体)
可可公司——控制塔顿
原标题:Cocoa Touch - Holding down buttons

只要 but子被 down倒,怎么能够反复使用这种方法。 只要 but子被击落,这种形象就会上升。

-(IBAction)thrustButton{ //moves ship foward

    yCoordinate = yCoordinate - 2;

    [UIView beginAnimations:@"slide-up" context:NULL];
    shipImageView.center = CGPointMake(xCoordinate,yCoordinate);  // change this to somewhere else you want.
    [UIView commitAnimations];
} 

感谢!

最佳回答

你们可以登记两次控制活动:

[yourButton addTarget:self action:@selector(doneButtonPressed) forControlEvents:UIControlEventTouchDown];


[yourButton addTarget:self action:@selector(doneButtonReleased) forControlEvents:UIControlEventTouchUpInside];

之后处理2种方法:

- (void)doneButtonPressed { 
  // open a thread
  while(someBOOL) {
    //do something you want 
  }
}

- (void)doneButtonReleased {
  // do something
  someBOOL = NO;
}
问题回答

暂无回答




相关问题
How do you create UIBarButtonItems with a radio interface?

I have a UIToolbar that needs three buttons in a radio style, meaning that of the three, only one button can be pushed at a time. The documentation makes reference to the possibility of setting up ...

iPhone settings bundle

I want to allow the user to enter a valid date using the iPhone’s settings application. I have experimented with many of the PreferenceSpecifiers data node types including date. I have two issues: ...

Circular #import/@class problem in ObjectiveC

I m going to use an example to properly illustrate my confusion. I can t quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC ...

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 ...

Cocoa-Touch: issue looping MPMoviePlayerController

I have an app which has to load some data at startup, so I want to display a splash-screen animation. I m using the MPMoviePlayerController to play a m4v file. The movie has it s background set to [...

Iphone sequential animation with setAnimationDelay

I m trying to chain animation events. The application I m coding for work has a multiple choice quiz. First you pick your multiple choice answer. The quiz view fades away. Then a label ("correct" or "...

热门标签