i have added multiple uitextfields programatically on uiscrollview its working fine and displaying text in ios 7 . but i am facing problem on ios 6 it does not display text its just display a large empty area with black background on uiscrollview this is the code
// set array values to label
-(void)addTextViews:(NSArray *)qualArray
{
//adding qualification label
UILabel *qualLbl;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
qualLbl = [[UILabel alloc]initWithFrame:CGRectMake(10, imgVw.bounds.size.height+20, 100, 20)];
[qualLbl setFont:[UIFont boldSystemFontOfSize:14.0]];
}
else
qualLbl = [[UILabel alloc]initWithFrame:CGRectMake(10, imgVw.bounds.size.height+20, 150, 20)];
[qualLbl setFont:[UIFont boldSystemFontOfSize:20.0]];
}
[qualLbl setTextColor:[UIColor colorWithRed:226.0f/255.0f green:73.0f/255.0f blue:20.0f/255.0f alpha:1.0]];
[qualLbl setBackgroundColor:[UIColor clearColor]];
[qualLbl setText:@"Qualification"];
[self.srcVw addSubview:qualLbl];
// adding text views
NSLog(@"img view height %f",imgVw.bounds.size.height);
height = imgVw.bounds.size.height + 55;
for (int i = 0; i < qualArray.count ; i++) {
UITextView *txtVw ;
UILabel *symbolLabel;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
txtVw =[[UITextView alloc]initWithFrame:CGRectMake(35, height, self.srcVw.bounds.size.width-50, 0)];
[txtVw setFont:[UIFont systemFontOfSize:12.0]];
symbolLabel =[[UILabel alloc]initWithFrame:CGRectMake(10, height, 25, 25)];
[symbolLabel setFont:[UIFont systemFontOfSize:12.0]];
}
else
{
txtVw =[[UITextView alloc]initWithFrame:CGRectMake(35, height, self.srcVw.bounds.size.width-50, 0)];
[txtVw setFont:[UIFont systemFontOfSize:20.0]];
symbolLabel =[[UILabel alloc]initWithFrame:CGRectMake(10, height, 25, 25)];
[symbolLabel setFont:[UIFont systemFontOfSize:12.0]];
}
[txtVw setScrollEnabled:NO];
[txtVw setEditable:NO];
[txtVw setText:[NSString stringWithFormat:@"%@" ,[qualArray objectAtIndex:i]]];
[txtVw sizeToFit];
[txtVw setTextColor:[UIColor whiteColor]];
[txtVw setBackgroundColor:[UIColor clearColor]];
[self.srcVw addSubview:txtVw];
// [txtVw setContentMode:UIViewContentModeScaleAspectFit];
//setting symbol label properties
[symbolLabel setText:@">"];
[symbolLabel setBackgroundColor:[UIColor clearColor]];
[symbolLabel setTextColor:[UIColor colorWithRed:226.0f/255.0f green:73.0f/255.0f blue:20.0f/255.0f alpha:1.0]];
[self.srcVw addSubview:symbolLabel];
height = height + txtVw.frame.size.height;
}
}
its code working perfect in ios 7 but i don't know what is problen when i run it on ios 6
