Skip to main content
Participant
February 10, 2012
Question

Native Extension iOS UIButton, A way to attach to the screen

  • February 10, 2012
  • 1 reply
  • 640 views

Native Extension iOS UIButton, A way to attach to the screen

Crash is on the iPhone.


FREObject AddButton (FREContext ctx, void * funcData, uint32_t argc, FREObject argv [])

{

UIWindow *window = [[UIApplication sharedApplication] keyWindow];


button = [UIButton buttonWithType:UIButtonTypeRoundedRect];

[button setTitle:@"iOS TestButton" forState:UIControlStateNormal];

button.frame = CGRectMake(150, 150, 106, 53);

[window addSubview:button];


return NULL;

}

This topic has been closed for replies.

1 reply

Inspiring
February 10, 2012

I am a noobie on Objective-C, but I am not sure whether you need a UIViewController or not here. I made an extension which is very similar to yours, instead, mine has UIWebView. And it works well.

Anyone know Objective-C probably can solve this easily.

Good luck!