diff --git a/PaleoProject/PaleoProject/Custom/CustomCells/FoodCategoryCell/FoodCategoryCell.m b/PaleoProject/PaleoProject/Custom/CustomCells/FoodCategoryCell/FoodCategoryCell.m index 0fc24fe..828f189 100644 --- a/PaleoProject/PaleoProject/Custom/CustomCells/FoodCategoryCell/FoodCategoryCell.m +++ b/PaleoProject/PaleoProject/Custom/CustomCells/FoodCategoryCell/FoodCategoryCell.m @@ -23,8 +23,7 @@ - (void)dealloc { //Utiliza as informações do model para popular a célula -(void)setCategoryModel:(FoodCategoryModel*)categoryModel_{ categoryModel = categoryModel_; - //todo: criar method auxiliar para verificar a existencia de imagens no projeto - if ([categoryModel_.imageName isEqualToString:@"default.png"]) { + if (![Utils existThisImage:categoryModel_.imageName]) { //gatodo: categoryMode.name sem imagem categoryModel_.imageName = @"defaultImage.png"; } diff --git a/PaleoProject/PaleoProject/Utils/Utils.h b/PaleoProject/PaleoProject/Utils/Utils.h index b56fc88..3336107 100644 --- a/PaleoProject/PaleoProject/Utils/Utils.h +++ b/PaleoProject/PaleoProject/Utils/Utils.h @@ -29,6 +29,8 @@ +(void)debugAlert:(NSString*)message; ++(BOOL)existThisImage:(NSString*)imageName; + @end @interface NSString (custom) diff --git a/PaleoProject/PaleoProject/Utils/Utils.m b/PaleoProject/PaleoProject/Utils/Utils.m index 7209bcb..4576a8f 100644 --- a/PaleoProject/PaleoProject/Utils/Utils.m +++ b/PaleoProject/PaleoProject/Utils/Utils.m @@ -22,6 +22,17 @@ + (Utils *) sharedInstance{ return _instance; } +#pragma mark - UIImage + +//Verifica se existe no projeto, alguma imagem com esse nome ++(BOOL)existThisImage:(NSString*)imageName{ + UIImage *image = [UIImage imageNamed:imageName]; + if (image) { + return YES; + } + return NO; +} + #pragma mark - NSString auxiliar //retorna uma NSString minuscula e sem acento diff --git a/PaleoProject/PaleoProject/images/default b/PaleoProject/PaleoProject/images/default deleted file mode 100644 index c708c95..0000000 Binary files a/PaleoProject/PaleoProject/images/default and /dev/null differ