Iphone 如何在单击xcode时增加某些内容

Iphone 如何在单击xcode时增加某些内容,iphone,ios,xcode,Iphone,Ios,Xcode,我在一个didloader中有两组变量,希望它们在每次执行iActionstart时递增 以下是我举的例子 - (void)viewDidLoad { [super view]; //X Speed and Y Speed pos = CGPointMake(2,1); pos2 = CGPointMake(2,1); } - (IBAction)start { ) 我没有将int赋值给2,1 ect,但是pos和pos2的值将不同只要在调用start

我在一个didloader中有两组变量,希望它们在每次执行
iAction
start时递增

以下是我举的例子

- (void)viewDidLoad
{
    [super view];
    //X Speed and Y Speed
    pos = CGPointMake(2,1);
    pos2 = CGPointMake(2,1);

}


- (IBAction)start 
{

)

我没有将int赋值给2,1 ect,但是pos和pos2的值将不同

只要在调用
start
方法时增加x和y值即可

- (void)viewDidLoad
{
    [super view];
    //X Speed and Y Speed
    pos = CGPointMake(2,1);
    pos2 = CGPointMake(2,1);

}


- (IBAction)start 
{
   //So you just increment their x and y values
   pos.x += 1;
   pos.y += 1;

   pos2.x += 2;
   pos2.y += 1;
}