uitableview - iOS 7 - text in custom tableViewCell content getting cut -


i have been trying figure out past couple of hours no avail. have custom tableviewcell class use tableviewcells. have 3 labels , 2 textfields in custom class. here searchresulttableviewcell.h file:

#import <uikit/uikit.h>  @interface searchresulttableviewcell : uitableviewcell  @property (strong, nonatomic) iboutlet uilabel *price; @property (strong, nonatomic) iboutlet uilabel *itemname; @property (strong, nonatomic) iboutlet uilabel *discount; @property (strong, nonatomic) iboutlet uitextfield *quantity; @property (strong, nonatomic) iboutlet uitextfield *discountinput;  @end 

the text labels populated database entries. issue i'm having right when itemname long, gets cut in display. have tried setting lines property of label in storyboard 3 lines not work. have idea on how implement multiple lines in label? thank you.

in customtableviewcell.m

    self.itemname.numberoflines = 0; // change 0 support multiple lines     self.itemname.linebreakmode = nslinebreakbywordwrapping;     cgrect frame = self.itemname.frame; // cache frame of item name label     cgfloat itemwidth = frame.size.width; // keep width variable     cgsize constraint = cgsizemake(itemwidth, 2000); // define constraint, unlimited height, , width original width     cgsize size = [self.itemname.text sizewithfont:self.itemname.font constrainedtosize:constraint linebreakmode:self.itemname.linebreakmode]; // size fit content     size.width = itemwidth; // use original width     frame.size = size; // update size frame cached     self.itemname.frame = frame; // update item name label frame 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -