我的代碼是這樣......獲得目標C
NSString *str=[arrInitiatives valueForKey:@"FileName"];
NSLog(@"file name ----> %@",str);
NSString *imageUrl = [NSString stringWithFormat:@"%@%@", PUBLIC_UTILITY_FORMS_URL,str];
NSLog(@"----> %@",imageUrl);
[_image_imageview setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"noimage.png"]];
//http://setupolice.org/brcsetu/UploadFile/Lighthouse4908.jpg
從字符串數組簡單的值,我會得到這個
file name ----> (
"Lighthouse4908.jpg"
)
----> http://setupolice.org/brcsetu/UploadFile/(
"Lighthouse4908.jpg"
)
I want this
----> http://setupolice.org/brcsetu/UploadFile/Lighthouse4908.jpg
檢查NSString類文檔,他們有方法來告訴路徑擴展名和文件名等 – Shubhank