行数の多いUILabelがあります。行数は実行時に異なります。しかし、UILineBreakmodeが正しく機能していません。
これはコードです:
-(void)viewDidLoad
{
NSString *temp=@"";
for(int i=0;i<[arr2 count];i++)
{
temp=[temp stringByAppendingString:[[array objectAtIndex:i]objectForKey:@"Specilities"]];
temp=[temp stringByAppendingString:@","];
}
temp = [temp substringToIndex:[temp length]-1];
CGSize constraint8 = CGSizeMake(190, 2000.0f);
CGSize size8=[temp sizeWithFont:[UIFont fontWithName:@"Helvetica" size:14] constrainedToSize:constraint8 lineBreakMode:UILineBreakModeWordWrap];
specialities =[[UILabel alloc]init];
[specialities setFrame:CGRectMake(124,270,190, size8.height)];
specialities.textAlignment=UITextAlignmentLeft;
specialities.backgroundColor=[UIColor clearColor];
specialities.font=[UIFont fontWithName:@"Helvetica" size:14];
specialities.text=[NSString stringWithFormat:@"%@ ",temp ];
specialities.numberOfLines=0;
[specialities sizeToFit];
[self.view addSubview:specialities];
}
Expected result:
Family Dentistry,Dentist-
Child,Dentist-Family,
Orthodontist
The result which Im getting:
Family Dentistry,Dentist-
Child,Dentist-Family,Orthodo
ntist
どうすれば入手できますか?