我正在使用iOS应用程序,当我拿到网址时,它会给我以下网址: 打印aString的描述:
我的功能是:
- (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info
{
[self dismissViewControllerAnimated:YES completion:nil];
for (UIView *v in [_scrollView subviews]) {
[v removeFromSuperview];
}
CGRect workingFrame = _scrollView.frame;
workingFrame.origin.x = 0;
images = [NSMutableArray arrayWithCapacity:[info count]];
NSLog(@" info count :%lu",info.count);
countere=(NSUInteger*)info.count;
NSLog(@" countere :%lu",(unsigned long)countere);
for (NSDictionary *dict in info) {
// NSString *filename;
image = [dict objectForKey:UIImagePickerControllerOriginalImage];
[images addObject:image];
imageview = [[UIImageView alloc] initWithImage:image];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
imageview.frame = workingFrame;
NSURL * imagepath=[info valueForKey:UIImagePickerControllerReferenceURL];
NSLog(@"fileName : %@",imagepath);
dropboximagepath=(NSString*)imagepath;
}
我的结果是:
的ImagePath = < __ NSArrayI 0x10ad4d490>( ?资产库://asset/asset.JPG ID = 7E3818C6-EF97-441B-81E4-916DD5B71DD0和放大器; EXT = JPG )
我想提取
“ assets-library://asset/asset.JPG?id = 7E3818C6-EF97-441B-81E4-916DD5B71DD0& ext = JPG ”
从上面的结果。请告诉我如何提取我想要的结果并将其保存在一个字符串中,以便我可以将该url路径发送到下一个控制器?
答案 0 :(得分:1)
你收到了一个元素的数组,所以最简单的就是
[array objectAtIndex:0]
它将为您提供NSURL或NSString(取决于逻辑) 您可以将NSURL转移到NSString,或者如果您需要提取它的单独部分,您可以使用NSURL方法,例如
– absoluteString
– absoluteURL
– baseURL
– fileSystemRepresentation
– fragment
– host
– lastPathComponent
– parameterString
– password
– path
– pathComponents
– pathExtension
– port
– query
– relativePath
– relativeString
– resourceSpecifier
– scheme
– standardizedURL
– user