Note that there are some explanatory texts on larger screens.

plurals
  1. POUIButton Programmatically based on device
    primarykey
    data
    text
    <p>I have created a UIButton programmatically that is inserted on either a iPhone or iPad only application. Is it possible to do it for a universal app (i.e....change the size of the button and location to fit the device UI)?</p> <pre><code>//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///////////////////////////////// //Call method to show inbox -(void) showAppInbox { [[AppInboxManager sharedManager] show]; } </code></pre> <p>//new code //BEGIN insert button for INBOX///////////////////////////////////////////////////////////</p> <pre><code> if ([[[UIDevice currentDevice] model] isEqualToString:@"iPhone"]) { appButton.frame = CGRectMake(200, 25, 24, 16); } else { appButton.frame = CGRectMake(700, 25, 24, 16); } appButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; [appButton setBackgroundImage:[UIImage imageNamed:@"envelope_white.png"] forState:UIControlStateNormal]; appButton.layer.borderColor=[UIColor clearColor].CGColor; appButton.backgroundColor = [UIColor clearColor]; [appButton addTarget:self action:@selector(showAppInbox) forControlEvents:UIControlEventTouchDown]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload