i 急于从方案角度撰写我的分观点,原因是,我想要把冰带上布顿的图像。 因此,我写了我的文.和我的文.,用直截了当的方法看待:
- (id)init
{
if (self = [super init]){
redBlack = [UIImage imageNamed:@"redB.png"];
redWhite = [UIImage imageNamed:@"redW.png"];
redButton = [UIButton buttonWithType:UIButtonTypeCustom];
redButton.frame = CGRectMake(20.0, 30.0, 130.0, 130.0);
[redButton setBackgroundImage:redBlack forState:UIControlStateNormal];
[redButton setBackgroundImage:redWhite forState:UIControlEventTouchDown];
[redButton addTarget:self action:@selector(controller.colorButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
[redButton setTag:0];
[self.view addSubview:redButton];
.....
The Problem is, that colorButtonPressed is a Method, which is written in my ControllerView-Singleton.
I don t know if i am doing this right, but actually i wanted to keep the MVC as clean as possible. Is it a common way to do it like this and if so, the compiler doesnt let me write controller.colorButtonPressed: in @selector ?!?
Or should i specify the programmatically written view also in my controller class?
Hopefully these questions dont sound too stupid!?
And thanks in advance!