Discussion Forums  >  Uncategorized

Replies: 4    Views: 1094

Everest11
Code is Art
Profile
Posts: 195
Reg: Apr 04, 2011
GA, USA
1,950
05/26/11 11:21 AM (14 years ago)

David & Co. - UIButton programmatically for universal apps

David, I am able to integrate a APN service into my BT apps but only for specific device. Is it possible to create the UIButton that opens the inbox for a universal app? This is what I am using now in the appdelegate: //insert button for inbox/////////////////////////////////////////////////////////// appButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; [appButton setBackgroundImage:[UIImage imageNamed:@18-envelope.png] forState:UIControlStateNormal]; appButton.layer.borderColor=[UIColor clearColor].CGColor; appButton.backgroundColor = [UIColor whiteColor]; appButton.frame = CGRectMake(290.0, 25.0, 24.0, 24.0); [appButton addTarget:self action:@selector(showAppInbox) forControlEvents:UIControlEventTouchDown]; [self.window addSubview:appButton]; //END/////////////////////////////////
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/26/11 12:20 PM (14 years ago)
Are you asking how to resize the button? Like one for an iPad and one for an iPhone? It would be a matter of: a) Determining if the device is an ipad or not b) Using a different image and frame if it is. The button action would be the same. I say this without knowing what the showAppInbox method does? I'm assuming it opens another app.
 
Everest11
Code is Art
Profile
Posts: 195
Reg: Apr 04, 2011
GA, USA
1,950
like
05/26/11 12:25 PM (14 years ago)
You are correct (resize and change location). The way the UIButton is inserted as above would be skewed on the iPad UI. I have been trying to wrap my head around this but am making little progress. //Call this method to make the push notification inbox appear - (void) showAppInbox { [[AppInboxManager sharedManager] show]; }
 
Everest11
Code is Art
Profile
Posts: 195
Reg: Apr 04, 2011
GA, USA
1,950
like
05/26/11 12:51 PM (14 years ago)
Here are a few screenshots with it on the iPhone. What would be useful is if I were able to set the click event to call the inbox on one of the tabbed menu items. http://i52.tinypic.com/34paryg.jpg http://i53.tinypic.com/xfp85f.jpg http://i53.tinypic.com/3038vgo.jpg http://i55.tinypic.com/w9zjw4.jpg http://i53.tinypic.com/rt0y7a.jpg http://i51.tinypic.com/98fvki.jpg
 
Everest11
Code is Art
Profile
Posts: 195
Reg: Apr 04, 2011
GA, USA
1,950
like
05/27/11 12:59 AM (14 years ago)
Well David, at 3:42 am I figured out how to display the button for a universal app: if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {//code here to place button on iPad UI} else {//code here to place button on iPhone UI}
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.