ios - Enlarge UIButton text? -
i use masonry library create auto layout constraints programmatically. here code creating uibutton:
readnext = [uibutton buttonwithtype:uibuttontyperoundedrect]; readnext.titlelabel.adjustsfontsizetofitwidth = yes; readnext.titlelabel.linebreakmode = nslinebreakbyclipping; [readnext settitle:@"Читать дальше" forstate:uicontrolstatenormal]; [self.view addsubview:readnext]; [readnext mas_makeconstraints:^(masconstraintmaker *make) { make.width.equalto(@160); make.height.equalto(@80); make.right.equalto(newscontainerview.mas_right).with.offset(-20); make.bottom.equalto(newscontainerview.mas_bottom).with.offset(-20); }];
basically mean create button aligned right , bot of view, , width of button 160 points, , height 80. however, label text font small. when expand width or height (or both) no changing. how fix that?
there no property available increase font size frame size increases.
adjustsfontsizetofitwidth boolean value indicating whether font size should reduced in order fit title string label’s bounding rectangle.
what can set font of titlelabel
large value 100 , set adjustsfontsizetofitwidth
true. make font size shrink automatically text adjusts in given frame size.
Comments
Post a Comment