आप छवि डाउनलोड करने के अनुसार UIImageView
आकार बना सकते हैं लेकिन यह खराब दिखने वाला देगा।
तो मैं तुम्हें एक ही आकार के अपने सभी छवि बनाने के लिए सुझाव देते हैं, तो यह ठीक है और मिठाई
आप इस का उपयोग कर सकते एक ही आकार के अपने सभी छवि बनाने के लिए लग रही हो जाएगा।
+ (UIImage *)imageScaledToSizeWithImage:(UIImage *)imagewww andsizeee:(CGSize)size
{
//avoid redundant drawing
if (CGSizeEqualToSize(imagewww.size, size))
{
return imagewww;
}
//create drawing context
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
//draw
[imagewww drawInRect:CGRectMake(0.0f, 0.0f, size.width, size.height)];
//capture resultant image
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//return image
return image;
}
यदि आपको वास्तव में अलग पंक्ति आकार के साथ तालिका दिखाना चाहते हैं तो रन टाइम
पर अपनी पंक्ति आकार बदलने के लिए जब आप छवि मिल जाएगा तो कुंजी मान के साथ शब्दकोश में अपनी छवि बचाने के लिए करना पंक्ति के indexPath है ।
[tableImageDict setObject:image forKey:[NSString stringWithFormat:@"%i,%i",indexPath.row,indexPath.section]];
और फिर अपनी तालिका पंक्ति पुनः लोड करें।
[table reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationNone];
यह फिर आदमी के लिए अपने पंक्ति की ऊँचाई
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UIImage *image = (UIImage *)[tableImageDict objectForKey:
[NSString stringWithFormat:@"%i,%i",
indexPath.row,indexPath.section]];
if (image != nil)
{
return image.size.height;
}
else{
return 44.0;
}
}
सवालों की एक जोड़ी बदल जाएगा। क्या ये छवियां स्क्रीन की 320px चौड़ाई पूरी कर लेंगी? या चौड़ाई के बावजूद, वे सिर्फ दूसरे के नीचे प्रदर्शित होंगे? या यदि पिछली छवि की चौड़ाई 320 से कम है और अगला भी शेष चौड़ाई (320-prev_img_width) में फिट हो सकता है तो यह पिछली छवि के आगे या पिछला नीचे दिखाई देगा। –