我怎麼能只顯示原始圖像的部分在一個UIImageView在一個UIImageView只顯示原始圖像的部分
這個問題可能很熟悉,老,但是對於再次詢問原因,我在這些答案的幫助下找不到一個可行的想法 許多人說設置image.contentMode = UIViewContentModeCenter; (但不工作)
我需要一個幾乎包含原始圖像中心的矩形,我如何得到這個?
當我向應用程序顯示靜態圖像並將UIImageVie的內容模式設置爲Aspect Fill時,我確實做到了這一點。 但是,這是不是在當我顯示來自URL的圖像,並使用NSData的
添加我的代碼和圖片
NSString *weburl = @"http://topnews.in/files/Sachin-Tendulkar_15.jpg";
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 50, 108, 86)];
NSURL *url = [NSURL URLWithString:weburl];
NSData *data = [NSData dataWithContentsOfURL:url];
imageView.image = [UIImage imageWithData:data];
[self.view addSubview:imageView];
atleast請讀取問題..這不是關於設置內容模式 –
現在嘗試。寫下你的評論 – rakeshNS
現在你來了一聲巨響.....感謝哥們,非常感謝你 現在你值得+1 ....和接受 –