Possible Duplicate:
C function calling objective C functions
I've done the following code in ViewController.m
-(void) callIncomingCreateButton
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//set the position of the button
button.frame = CGRectMake(100, 170, 100, 30);
//set the button's title
[button setTitle:@"Click Me!" forState:UIControlStateNormal];
//add the button to the view
[self.view addSubview:button];
}
- (IBAction)DemoCall:(id)sender {
callIncoming(1, "a");
}
int callIncoming(int a, char* b)
{
ViewController * tempObj = [[ViewController alloc] init];
[tempObj callIncomingCreateButton];
return a;
}
But still the UIButton is not getting displayed, what am I missing here.
Edit : this is for iOS and yes, the function does get called. I put a breakpoint and stepped it through.