我很清楚这是一个简单的问题。我想了解如何在用户选择CGRect/UIButton时将其移动到屏幕上的其他位置。感谢您的帮助提前。UIView/UIControl在点击时改变屏幕位置
- (void)showMeSomeButtons:(CGRect)frame{
button = [[UIButton alloc] initWithFrame:frame];
button.frame = CGRectMake(240, 150, 50, 50);
UIImage *buttonGraphic = [UIImage imageNamed:@"1.png"];
[button setBackgroundImage:buttonGraphic forState:UIControlStateNormal];
[button addTarget:self.viewController action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
}
-(void)buttonClicked{
???
}
两个问题的移动RECT的起源,当我进入前代码它告诉我,“的CGRect没有名为“成员x'“和'y'一样,我忘了添加一些东西。而且这也是一个更基本的问题,但顶端添加的(id)发件人是什么?非常感谢。 – 2011-01-20 23:05:16