Monday 15 April 2013

iphone - How to add an image after the dynamic label? -


I had an application in which I am adding an image after the label, the label is dynamic. I need to add an image after that UILabel I tried `

  dropdown-label = [[UILabel alloc] init]; [Dropdown label set frame: CGRactack (90, 8180, 30)]; [Dropdown label set font: [UIFont fontWithName: @ "helvetica-bold" size: 20]]; Dropdownlabel.textAlignment = UITextAlignmentLeft; Dropdownlabel.textColor = [UIColor whiteColor]; Dropdownlabel.numberOfLines = 0; Dropdownlabel.text = @ "gdhhgsfghdfagsfd"; Dropdownlabel.backgroundColor = [UIColor clear collar]; [Naviview adsview: dropdown label]; CGSize maxLabelSize = CGSizeMake (99 99, 30); CGSize Expected Label = [dropdownlabel.text sizeWithFont: [UIFont fontWithName: @ "helvetica-bold" Size: 20] CompelueTown size: maximum label encoding lineComeded: dropdown-labels. LinearModa]; // Adjust labels to the new height CGRTFframe = dropdown label Frame; NewFrame.size.height = Expected label size. height; Dropdownlabel.frame = newFrame; NSLog (@ "% f", newFrame.size.width); UIImageView * navview1 = [[UIImageView alloc] initWithFrame: CGRectMake (newFrame.size.width + 15,13,20,20)]; Navview1.image = [UIImage imageNamed: @ "down_sml_arrow.png"]; Navview1.userInteractionEnabled = Yes; [Nviveeveviewview: Navview 1];   

But for some, this is right, but for the second it is wrong. Can someone guide me, where am I going wrong?

  dropdown label = [[UILabel alloc] init]; [Dropdown label set frame: CGRactack (90, 8180, 30)]; [Dropdown label set font: [UIFont fontWithName: @ "helvetica-bold" size: 20]]; Dropdownlabel.textAlignment = NSTextAlignmentRight; Dropdownlabel.textColor = [UIColor whiteColor]; Dropdownlabel.numberOfLines = 0; Dropdownlabel.text = @ "gdhhgsfghdfagsfd"; Dropdownlabel.backgroundColor = [UIColor clear collar]; [Naviview adsview: dropdown label]; CGSize expected labels size = [dropdownlabel.text sizeWithFont: dropdownlabel.font]; // Adjust labels to the new height CGRTFframe = dropdown label Frame; NewFrame.size = Required label schema; Dropdownlabel.frame = newFrame; UIImageView * navview1 = [[UIImageView alloc] initWithFrame: CGRectMake (newFrame.origin.x + newFrame.size.width + 15,13,20,20)]; Navview1.image = [UIImage imageNamed: @ "down_sml_arrow.png"]; Navview1.userInteractionEnabled = Yes; [Nviveeveviewview: Navview 1];    

No comments:

Post a Comment