hello,
i've the following code for button creation and on action of button , i'm calling buildUI method
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];
} -(void)buildUIWorkArea { //UIView* uiWorkAreaView_G_obj; [uiWorkAreaView_G_obj clearsContextBeforeDrawing]; CGRect cgRct2 = CGRectMake(0.0, 0.0, 480, 320); //define size and position of View uiWorkAreaView_G_obj = [[UIView alloc] initWithFrame:cgRct2]; //initilize the view 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];
}
On click of button UI which is on UIView uiWorkAreaView_G_obj , it has to create one more button BUTTON on UIView uiWorkAreaView_G_obj.and after placing the button each of there subviews, i'm placing those subviews upon a common mainview_G_obj of type UIView. But its throwing an exception .......
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIView buildUIWorkArea]:unrecognized selector sent to instance 0x57ca80'
i didn't understand why its taking buildUIWorkArea's return type as UIView , when i've declared its return type as void.
plz help.