iOS label中sizeToFit的使用

 UILabel *enterpriseAddress1=[[UILabel alloc]initWithFrame:CGRectMake(90, 130, 180, 20)];

            enterpriseAddress1.font = [UIFont systemFontOfSize:13]

            enterpriseAddress1.text = [NSString stringWithFormat:@"%@ %@",self.placeText,self.StoreMessage.address];

            [scrollView addSubview:enterpriseAddress1];

            [enterpriseAddress1 sizeToFit];



注:sizeToFit應放在[scrollView addSubview:enterpriseAddress1]的後面,否則文字無法顯示;

發佈了34 篇原創文章 · 獲贊 0 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章