मैं stretchableImageWithLeftCapWidth का उपयोग कर एक छवि का आकार करने के लिए कोशिश कर रहा हूँ के साथ एक छवि का आकार बदलना: यह सिम्युलेटर पर काम करता है, लेकिन डिवाइस पर, खड़ी हरी पट्टियों प्रकट होता है।stretchableImageWithLeftCapWidth
मैं उपयोग करने के लिए imageNamed, imageWithContentOfFile और imageWithData लो छवि को लोड की कोशिश की है, इसे बदल नहीं करता है।
UIImage *bottomImage = [[UIImage imageWithData:
[NSData dataWithContentsOfFile:
[NSString stringWithFormat:@"%@/bottom_part.png",
[[NSBundle mainBundle] resourcePath]]]]
stretchableImageWithLeftCapWidth:27 topCapHeight:9];
UIImageView *bottomView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 200+73, 100, 73)];
[self.view addSubview:bottomView];
UIGraphicsBeginImageContext(CGSizeMake(100, 73));
[bottomImage drawInRect:CGRectMake(0, 0, 100, 73)];
UIImage *bottomResizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
bottomView.image = bottomResizedImage;
परिणाम देखें: हरे रंग के सलाखों को वहां नहीं होना चाहिए, वे सिम्युलेटर पर दिखाई नहीं देते हैं।
alt text http://www.quicksnapper.com/files/5161/96232162149F1C14751048_m.png
वाह, धन्यवाद। –