Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center a UILabel on UIView

How can I center the UILabel on the UIView? I am using the following code

float width = weatherView.bounds.size.width;  float height = weatherView.bounds.size.height;   [self.label setFrame:CGRectMake(width-100,height-100, 100, 100)]; 
like image 559
john doe Avatar asked Jul 19 '11 20:07

john doe


1 Answers

How about:

[self.label setCenter:view.center]; 
like image 81
PengOne Avatar answered Sep 20 '22 11:09

PengOne