objective c - iOS: UILabel text setting issue -


i want place number & text in same line

i have used autolayout. if text small in question number & question displaying in same line text large , question displaying in 2 lines, @ time question number displaying in between question

i have set autolayout

question number autolayouts label

i want 1st question number & question on same line below image

enter image description here

uilabel alway centered in vertical axis.

what have calculate height of uilabel considering text given , font size using.

here bit of example:

cgrect yourrect = [[nsstring stringwithformat:@"%@", yourtexthere]                         boundingrectwithsize:cgsizemake(200, 40)                         options:nsstringdrawinguseslinefragmentorigin                         attributes:@{nsfontattributename: [uifont whateverfontyouuse:21]}                         context:nil];     self.questionidwidthconstraint.constant = yourrect.size.height + 1; 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -