1

動的な高さと y 原点の UILabel(4) を作成する必要があります。最初のラベルの y 原点を知っています。 、2 番目のラベルの y 原点が開始し、最初のラベルと同じように、コンテンツに応じて高さと行数を自動調整する必要があります。3 番目と 4 番目のラベルについても同様です。

これは私が取得する必要がある形式です:

        Name: Wilston Works
Working Days: Sun,Mon,Tue,Wed,Thu,  // Here only upto Thur then Workinh hrs should start       after that 
              Fri
 Working hrs:9 to 5
Specialities:General,parties,festival 
             specials,..............
             .......                     //lines depends on content may be 1 to many 

私のコード:

 displayName =[[UILabel alloc] init];
    [displayName setFrame:CGRectMake(10, companyaccess.frame.size.height+companyaccess.frame.origin.y,300, 30)]; //companyaccess is the label above this label 
    displayName.textAlignment = UITextAlignmentLeft; 
    displayName.backgroundColor = [UIColor clearColor];
    self.displayName.text= [NSString stringWithFormat:@" Name :"];
      [displayName setFont:[UIFont fontWithName:@"Helvetica" size:14]]; 
    [self.view addSubview:displayCompanyName];




        NSString *displayname1=[NSString stringWithFormat:@"%@",id1];
        CGSize constraint6 = CGSizeMake(250, 2000.0f);
        CGSize size6=[displaycompanyname1 sizeWithFont:[UIFont fontWithName:@"Helvetica-Bold" size:14] constrainedToSize:constraint6 lineBreakMode:UILineBreakModeWordWrap];
         displayName1 =[[UILabel alloc] init];
        [displayName1 setFrame:CGRectMake(155,companyaccess.frame.size.height+companyaccess.frame.origin.y,self.view.bounds.size.width,30) ];
        displayName1.textAlignment=UITextAlignmentLeft;
        displayName1.backgroundColor=[UIColor clearColor];
        [displayName1 setNumberOfLines:0];
       [displayName1 sizeToFit];
        displayName1.text=[NSString stringWithFormat:@"%@ " ,displayname1];
        displayName1.highlightedTextColor=[UIColor blackColor];
        [displayName1 setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14]];
        [self.view displayName1];

  displayWorkingDays=[[UILabel alloc] init];
    [displayWorkingDays setFrame:CGRectMake(10,displayName1.frame.size.height+displayName1.frame.origin.y,self.view.bounds.size.width,30)];
    displayWorkingDays.textAlignment=UITextAlignmentLeft;
    displayWorkingDays.backgroundColor=[UIColor clearColor];
    displayWorkingDays.text=[NSString stringWithFormat:@"Working Days   :"];
    [self.view addSubview:displayWorkingDays];


    displayWorkingDays1=[[UILabel alloc] init];
    [displayWorkingDays1 setFrame:CGRectMake(150,displayName1.frame.size.height+displayName1.frame.origin.y,self.view.bounds.size.width,40)];
    displayWorkingDays1.numberOfLines=0;
    displayWorkingDays1.textAlignment=UITextAlignmentLeft;
    displayWorkingDays1.backgroundColor=[UIColor clearColor];
    displayWorkingDays1.text=[NSString stringWithFormat:@"%@",temp1];
displayWorkingDays1.font=[UIFont fontWithName:@"arial" size:14];      
[displayWorkingDays1 sizeToFit];
[self.view addSubview:displayWorkingDays1];
............// for all the labels.But I could not get what i desired. 

}

上記の基準を満たす良い例を教えてください.bcoz私が試したものはすべて、あるシナリオでは機能し、他のシナリオでは機能しません。

どんな助けでも大歓迎です

4

0 に答える 0