4
NSString *thearticleImage = entry.articleImage;
NSRegularExpression *expression = [NSRegularExpression regularExpressionWithPattern:@"(?i)\\b((?:[a-z][\\w-]+:(?:/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}/)(?:[^\\s()<>]+|\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\))+(?:\\(([^\\s()<>]+|(\\([^\\s()<>]+\\)))*\\)|[^\\s`!()\\[\\]{};:'\".,<>?«»「」‘’]))" options:NSRegularExpressionCaseInsensitive error:NULL];
NSString *someString = thearticleImage;
self.theurl = [someString substringWithRange:[expression rangeOfFirstMatchInString:someString options:NSMatchingCompleted range:NSMakeRange(0, [someString length])]];
NSURL *picimage = [NSURL URLWithString:theurl];
NSData * urlData = [NSData dataWithContentsOfURL: picimage];
UIImage * imageweb = [UIImage imageWithData: urlData];
cell.imageView.frame = CGRectMake(0, 0, 70, 70);
cell.imageView.image = imageweb;
的問題是,這佔據了整個小區,我不知道爲什麼它不只是在左手邊。
那麼解決方案確實解決了這個問題,但有一個竅門。 – StackUnderflow