initWithFrame:
方法如下:
UIButton * dropB = [UIButton buttonWithType:UIButtonTypeRoundedRect];
dropB.frame = CGRectMake(190, 22, 52, 22);
dropB.backgroundColor = [UIColor clearColor];
dropB.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:11];
[dropB setTitle:@"DROP" forState:UIControlStateNormal];
[dropB addTarget:viewController
action:@selector(dropSelectedObject)
forControlEvents:UIControlEventTouchUpInside];
[self addSubview:dropB];
[UIView beginAnimations:@"MoveIt" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationBeginsFromCurrentState:YES];
self.dropButton.center = CGPointMake(self.dropButton.center.x + 80, self.dropButton.center.y -10);
self.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
self.center = CGPointMake(CENTER_X, CENTER_Y);
[UIView commitAnimations];
按钮只会被转换到一个新的位置,即上一个位置(我猜原始坐标是相对于视图的)。我怎样才能使它转换到我指定的点?