у меня есть следующий код для создания кнопки и действия кнопки, я вызываю метод buildUI
CGRect cgRct = CGRectMake(10 ,30 ,400, 320); //define size and position of view
subMainView_G_obj = [[UIView alloc] initWithFrame:cgRct]; //initilize the view
subMainView_G_obj.autoresizesSubviews = YES;
//set view property ov controller to the newly created view
// create Button's for modules in array (UIButtonTypeRoundedRect)
UIButton_G_obj = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
UIButton_G_obj.frame = CGRectMake(100,30,100,50);
[UIButton_G_obj setTitle:@"UI" forState:UIControlStateNormal];
UIButton_G_obj.backgroundColor = [UIColor clearColor];
[subMainView_G_obj addSubview:UIButton_G_obj];
//[UIButton_G_obj setEnabled:TRUE];
[UIButton_G_obj addTarget:subMainView_G_obj action:@selector(buildUIWorkArea) forControlEvents:UIControlEventTouchUpInside];
[mainView_G_obj addSubview:subMainView_G_obj];
}
- (недействительными) buildUIWorkArea
{
// UIView * uiWorkAreaView_G_obj;
[uiWorkAreaView_G_obj clearsContextBeforeDrawing];
CGRect cgRct2 = CGRectMake (0,0, 0,0, 480, 320); // определить размер и положение просмотра
uiWorkAreaView_G_obj = [[UIView alloc] initWithFrame: cgRct2]; // инициализируем вид
uiWorkAreaView_G_obj.autoresizesSubviews = YES;
(UIButtonTypeRoundedRect)buttonUIObj = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
buttonUIObj.frame = CGRectMake(100.30,100,50);
[buttonUIObj setTitle:BUTTON forState:UIControlStateNormal];
buttonUIObj.backgroundColor = [UIColor clearColor];
[uiWorkAreaView_G_obj addSubview:buttonUIObj];
[buttonUIObj addTarget:uiWorkAreaView_G_obj action:@selector(showModuleView:) forControlEvents:UIControlEventTouchUpInside];
[mainView_G_obj clearsContextBeforeDrawing];
[mainView_G_obj addSubview:uiWorkAreaView_G_obj];
}
При нажатии кнопки пользовательского интерфейса, который находится в UIView uiWorkAreaView_G_obj, необходимо создать еще одну КНОПКУ кнопки в UIView uiWorkAreaView_G_obj.and после размещения кнопки в каждом из этих подпредставлений, я помещаю эти подпредставления в общий mainview_G_obj типа UIView.
Но это исключение .......
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView buildUIWorkArea]:unrecognized selector sent to instance 0x57ca80'
Я не понял, почему он принимает тип возвращаемого значения buildUIWorkArea как UIView, когда я объявил тип возвращаемого значения как void.
PLZ Help.