dot*_*dot 0 iphone cocoa-touch objective-c
我有这样一个数组:
self.youtubeVideos = [NSArray arrayWithObjects:
@"http://example.com/index.php?number=1&keyword=",
@"http://example.com/index.php?number=2&keyword=",
nil];
Run Code Online (Sandbox Code Playgroud)
我想在数组中的每个对象的末尾添加一个名为"searchKeyword"的NSString.
我该怎么做呢?
谢谢!
创建一个可变数组,然后逐步执行并修改每个元素.
NSMutableArray* fixedUrls = [NSMutableArray arrayWithCapacity:self.youtubeVideos.count];
for (NSString* url in self.youtubeVideos)
{
[fixedUrls addObject:[url stringByAppendingString:searchKeyword]];
}
self.youtubeVideos = fixedUrls;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
327 次 |
| 最近记录: |