मुझे UIWebView के लोड HTMLString के साथ एक अजीब समस्या है, जहां यह केवल एक खाली दृश्य प्रदर्शित करेगा जब मैंने अपनी सामग्री HTML स्ट्रिंग के साथ loadHTMLString कहा था। इससे कोई फर्क नहीं पड़ता कि htmlstring की सामग्री क्या है, यह बस कुछ भी नहीं करता है।UIWebView loadHTMLString रिक्त स्क्रीन दिखाता है
अजीब बात यह है कि यह कुछ हफ्ते पहले काम करता था, जब मैंने सिम्युलेटर और डिवाइस पर इसका परीक्षण किया था। मेरे कोड के नीचे है:
NSMutableString *sHtmlBuf = [NSMutableString stringWithString:@"<body style=\"background-color: #000000; color: #FFFFFF; font-family: Helvetica; font-size: 10pt; width: 300px; word-wrap: break-word;\">"];
if ([m_oCallArray count] > 0 || [m_oPutArray count] > 0) {
[sHtmlBuf appendString:sWarrTitle];
if ([m_oCallArray count] > 0) {
NSString *formattedCall = [NSString stringWithFormat:@"%@ %@<br />",sCallTitle,[self arrayToString:m_oCallArray]];
[sHtmlBuf appendFormat:@"%@ ",formattedCall];
}
if ([m_oPutArray count] > 0) {
NSString *formattedPut = [NSString stringWithFormat:@"%@ %@<br />",sPutsTitle,[self arrayToString:m_oPutArray]];
[sHtmlBuf appendFormat:@"%@ ",formattedPut];
}
}
if ([m_oBullArray count] > 0 || [m_oBearArray count] > 0) {
[sHtmlBuf appendString:sCbbcTitle];
if ([m_oBullArray count] > 0) {
NSString *formattedBull = [NSString stringWithFormat:@"%@ %@<br />",sBullTitle,[self arrayToString:m_oBullArray]];
[sHtmlBuf appendFormat:@"%@ ",formattedBull];
}
if ([m_oBearArray count] > 0) {
NSString *formattedBear = [NSString stringWithFormat:@"%@ %@<br />",sBearTitle,[self arrayToString:m_oBearArray]];
[sHtmlBuf appendFormat:@"%@ ",formattedBear];
}
}
if ([m_oOtherArray count] > 0) {
NSString *formattedOther = [NSString stringWithFormat:@"%@ %@<br />",sOtherTitle,[self arrayToString:m_oOtherArray]];
[sHtmlBuf appendFormat:@"%@ ",formattedOther];
}
[m_oDataPresentView loadHTMLString:sHtmlBuf baseURL:nil];
(ध्यान दें: एचटीएमएल यह समस्या पहले भी एक नियमित रूप से वेब ब्राउज़र पर प्रदान कर सकते हैं, तो एचटीएमएल एक समस्या नहीं है)
संपादित करें: जोड़ा प्रवर्तन कोड:
//Create wcbbc panel
wcbbcPanel = [[WarrantsAndCbbc alloc] initWithFrame:CGRectMake(320, 0, 320, 230)];
[m_oMainContentScrollView addSubview:wcbbcPanel];
UIView प्रवर्तन कोड:
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
CGRect oFrame = frame;
CGPoint oPositionCoords = CGPointMake(0, 0);
oFrame.origin = oPositionCoords;
m_oDataPresentView = [[UIWebView alloc] initWithFrame:oFrame];
[m_oDataPresentView loadHTMLString:@"<html><body style=\"background-color: #000000; color: #FFFFFF; font-family: Helvetica; font-size: 10pt; width: 300px; word-wrap: break-word;\"></body></html>" baseURL:nil];
m_oDataPresentView.delegate = self;
[self addSubview:m_oDataPresentView];
}
return self;
}
क्या आप हमें वह कोड दिखा सकते हैं जहां आप 'UIWebView' को तुरंत चालू करते हैं और इसे अपने दृश्य में जोड़ते हैं? – donkim