iphone - load image in web view from a .html file -
मैं .html फ़ाइल से iphone वेबदृश्य में एक छवि कैसे लोड कर सकता हूं?
आसान
NSString * bundlePath = [[NSBundle मुख्य बंडल] बंडलपाथ]; एनएसड्राएल * बंडलबरेस-यूआरएल = [एनएसयूआर फ़ाइल URL विथपाथ: बंडलपाथ]; एनएसएलॉग (@ "वेबव्यू% @", बंडलपाथ); NSString * filePath = [[NSBundle मुख्य बंडल] pathForResource: @ "सूचकांक" टाइप की: @ "एचटीएमएल"]; एनएसडीटा * एचटीएमएलएडेटा = [एनएसडीटा डेटाविथ कंटेंटऑफ़फाइलः फाइलपाथ]; NSString * html = [NSString stringWithContentsOfFile: फ़ाइलपाठ एन्कोडिंग: NSStringEncodingConversionAllowLossy त्रुटि: शून्य]; यदि (htmlData) {[webView लोडडेटा: html डेटा MIMEType: @ "text / html" textEncodingName: @ "UTF-8" baseURL: bundleBaseURL]; }
अब अपने html में आप बस छवि को
Comments
Post a Comment