Sto cercando di aggiungere un customBadge come una visualizzazione secondaria di un UIButton -Aggiunta di una visualizzazione secondaria per UIButton
questo è il mio codice finora -
//msg count initiaition
//CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@"2"];
CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:@"2"
withStringColor:[UIColor whiteColor]
withInsetColor:[UIColor redColor]
withBadgeFrame:YES
withBadgeFrameColor:[UIColor redColor]
withScale:2.0
withShining:YES];
// Set Position of Badge 1
[customBadge1 setFrame:CGRectMake(self.view.frame.size.width/2-customBadge1.frame.size.width/2+_MsgHeadBtn.frame.size.width/2, 110, customBadge1.frame.size.width, customBadge1.frame.size.height)];
//add badge to view
[_MsgHeadBtn addSubview:customBadge1];
Il pulsante che sto cercando di aggiungere il la sottoview è _MsgHeadBtn, che è l'icona dell'email in alto a sinistra dello screenshot qui sotto. Stavo cercando di rendere il badge personalizzato visualizzato leggermente sopra e alla destra dell'icona della posta elettronica, ma alla fine ottengo il risultato nello screenshot!
Chiunque può offrire qualche consiglio su dove sto andando male !?
direi: '[customBadge1 SETFRAME: CGRectMake (_MsgHeadBtn.frame .size.width, 0, customBadge1.frame.size.width, customBadge1.frame.size.height)]; ' – sergio
@sergio: Grazie per le informazioni. Ho appena modificato la mia risposta :) –
funziona - bella! – Dancer