2013-07-12 2 views
0

Je veux juste dessiner un cercle avec un trait, le code ci-dessous dessine bien mais il remplit le cercle.comment dessiner un cercle avec seulement son coup

Je ne veux pas qu'il soit rempli. S'il vous plaît aidez-moi

self.circleView = [[UIView alloc] initWithFrame:CGRectMake(10,20,20,20)]; 
    circleView.alpha = 0.5; 
    self.circleView.layer.cornerRadius = 50; 
    self.circleView.backgroundColor = [UIColor whiteColor]; 

Répondre

1

changement

self.circleView.backgroundColor = [UIColor whiteColor]; 

à

self.circleView.backgroundColor = [UIColor clearColor]; 

et la frontière (AVC) ajouter

self.circleView.layer.borderColor = [[UIColor redColor] CGColor]; 
self.circleView.layer.borderWidth = 1; 
+0

il est vide maintenant, rien n'apparaît à l'écran – erdemgc

+1

oh vous devez définir la largeur de la frontière als o: 'self.circleView.layer.borderWidth = 2' –

+0

alors c'est le problème, je veux juste remplir à l'intérieur du cercle avec un nombre; mon code est UILabel * circleLabel = [[UILabel alloc] init]; [circleLabel setText: @ "1"]; [circleView addSubview: circleLabel]; mais cela ne fonctionne pas – erdemgc

Questions connexes