From 670d24001e739e6a5af6f2dace2875cb3d564b99 Mon Sep 17 00:00:00 2001 From: renanvs Date: Sun, 9 Mar 2014 02:01:27 -0300 Subject: [PATCH] =?UTF-8?q?criando=20m=C3=A9todo=20no=20Utils=20para=20ide?= =?UTF-8?q?ntificar=20se=20a=20imagem=20existe=20no=20projeto=20=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FoodCategoryCell/FoodCategoryCell.m | 3 +-- PaleoProject/PaleoProject/Utils/Utils.h | 2 ++ PaleoProject/PaleoProject/Utils/Utils.m | 11 +++++++++++ PaleoProject/PaleoProject/images/default | Bin 9675 -> 0 bytes 4 files changed, 14 insertions(+), 2 deletions(-) delete mode 100644 PaleoProject/PaleoProject/images/default 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 c708c955247c1120663588685ff56f2c30ac413f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9675 zcmbVyWmH_jvhLsz++6~}-7UCFa3_#K2ZA$$y9W=J;I4rn!QC0$3GObzgG1ir*nL0V zxj$a7Sv9@8tG=%8uH90#BQ?|%Fkg|q0ssJ*N{X^t005jMEdLf28AgdwEDB+Nq!2j+ zh_;h8#KX+h3Ls_aWNt;Hz@KD^4vdu#=ms1#IH1>Haq5EF$A-Wd?C_)p2sN|Mw_r*f>F) zz&1|KG&0%(G)(WzENmVB7BK%q;@vwDB}XvC%+bP1Nmh&&hQVQLYbhcmBgiixC@3o= z&kY-QIbLZlVP1JzX?{UoAz1+~d8vQP$~sxNIaoPD{w-_yKeBTFRraqjI5@*vmbG%V zb+@vVcXe{0`A4TkZ2!A1(*G6jU$U0}T^E`ED$5B|hV$>#{$Er5?;@D}{LTKyaA6Ps zF?}mXn7zBg47;I&Z5sff6;qOx((zn6F+uYrpR1=D`tgSIvcq@{Z#j|@1SY~utPbTf zW5tZuV)A3#oswp*+pRBB@eJdboa|v$u{}(bM)!^HsH$M+l$_>!6BaHhu+?`#br#(= zSpH@?aqZ8XJIr)%fY1*K?qi0%Rzqh zKPiU@;3)rZ1)%gV%}2=nOaK2XM;PG&<>lq^kAAY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