Note that there are some explanatory texts on larger screens.

plurals
  1. POPlace a Button over an Image Programmatically
    text
    copied!<p>I coded this:</p> <pre><code>UIButton *buttonPrint = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonPrint setImage:[UIImage imageNamed:@"stampa.png"] forState:UIControlStateNormal]; buttonPrint.frame = CGRectMake(15, 5, 117, 41); [buttonPrint addTarget:self action:@selector(print) forControlEvents:UIControlEventTouchUpInside]; [viewBack addSubview:buttonPrint]; //button mail UIButton *buttonMail = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonMail setImage:[UIImage imageNamed:@"mail.png"] forState:UIControlStateNormal]; buttonMail.frame = CGRectMake(0, 46, 117, 41); [buttonMail addTarget:self action:@selector(sendEmail) forControlEvents:UIControlEventTouchUpInside]; [viewBack addSubview:buttonMail]; //button facebook UIButton *buttonPublish = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonPublish setImage:[UIImage imageNamed:@"pubblica.png"] forState:UIControlStateNormal]; buttonPublish.frame = CGRectMake(20, 90, 117, 41); [buttonPublish addTarget:self action:@selector(publish) forControlEvents:UIControlEventTouchUpInside]; [viewBack addSubview:buttonPublish]; //button twitter UIButton *buttonTweet = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonTweet setImage:[UIImage imageNamed:@"tweet.png"] forState:UIControlStateNormal]; buttonTweet.frame = CGRectMake(4, 130, 117, 41); [buttonTweet addTarget:self action:@selector(tweet) forControlEvents:UIControlEventTouchUpInside]; [viewBack addSubview:buttonTweet]; - (void)sendEmail { NSLog(@"mail clicked"); } - (void)tweet { NSLog(@"tweetClicked"); } - (void)print { NSLog(@"printClicked"); } - (void)publish { NSLog(@"face clicked"); } </code></pre> <p>but the buttons does not work... What should i do??</p>
 

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