lundi 29 septembre 2014

UILabel not displaying after iOS 8.0 upgrade


Vote count:

0




Just updated to iOS 8.0 this morning. I have a piece of code which created some labels and displays them on the scree next to some images. It was working fine before the update. Now the label and the image is not displaying. Can some one please help as I have tried everything I can think of and nothing has solved my issue and couldn't find anyone else with a similar issue. Code attached below.



UIView *labelView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, kCategoryLabelHieght)];
labelView.backgroundColor = [self colorWithHexString:@"2D2D2D"];

UILabel *categoryTitle = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 200, kCategoryLabelHieght)];
categoryTitle.textAlignment = NSTextAlignmentLeft;
categoryTitle.text = text;
categoryTitle.font = [UIFont fontWithName:@"HelveticaNeue" size:14];

codeAppDelegate *appDelegate = (codeAppDelegate *)[[UIApplication sharedApplication] delegate];
NSArray *fetchedCategory = [appDelegate getCategoryByName:text];

UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(10, 2, 20, 20)];

if(fetchedCategory.count)
{
for (int t=0; t<fetchedCategory.count; t++) {
Dealcategory_List *catList = [fetchedCategory objectAtIndex:t];
NSString *titleImage = [self URLEncodeString:[NSString stringWithFormat:@"%@",catList.image]];
NSURL *url = [NSURL URLWithString:titleImage];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *imgTabs = [UIImage imageWithData:data];
// [header2 setImage:imgTabs forState:UIControlStateNormal];
[imgTabs resizableImageWithCapInsets: UIEdgeInsetsMake(5, 10, 2, 0) resizingMode: UIImageResizingModeTile];

img.image= imgTabs;
}
}
else
{
NSArray *fetchedNewsCategory = [appDelegate getNewsCategoryByName:text];

if(fetchedNewsCategory.count > 0)
{
for (int t=0; t<fetchedNewsCategory.count; t++) {
News_Categories *catList = [fetchedNewsCategory objectAtIndex:t];
NSString *titleImage = [self URLEncodeString:[NSString stringWithFormat:@"%@",catList.category_image]];
NSURL *url = [NSURL URLWithString:titleImage];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *imgTabs = [UIImage imageWithData:data];
// [header2 setImage:imgTabs forState:UIControlStateNormal];
[imgTabs resizableImageWithCapInsets: UIEdgeInsetsMake(10, 10, 2, 0) resizingMode: UIImageResizingModeTile];

img.image= imgTabs;
}
}
else
{
NSArray *fetchedCompetition = [appDelegate getCompetitionByName:text];

if(fetchedCompetition.count > 0)
{
for (int t=0; t<fetchedCompetition.count; t++) {
Competitions_List *catList = [fetchedCompetition objectAtIndex:t];
NSString *titleImage = [self URLEncodeString:[NSString stringWithFormat:@"%@",catList.competition_tab_image]];
NSURL *url = [NSURL URLWithString:titleImage];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *imgTabs = [UIImage imageWithData:data];
// [header2 setImage:imgTabs forState:UIControlStateNormal];
[imgTabs resizableImageWithCapInsets: UIEdgeInsetsMake(10, 10, 2, 0) resizingMode: UIImageResizingModeTile];

img.image= imgTabs;

break;
}
}
}
}

categoryTitle.textColor = color;
[labelView addSubview:img];
[labelView addSubview:categoryTitle];

[self.contentView addSubview:labelView];


asked 33 secs ago







UILabel not displaying after iOS 8.0 upgrade

Aucun commentaire:

Enregistrer un commentaire