Posts

Showing posts with the label UIWebView

inline HTML in UILable

//  UILabel + Html.h #import @interface UILabel ( Html ) -( void ) setHTMLText:( NSString *)htmlText; @end //  UILabel+appLabel.m #import "UILabel+appLabel.h" @implementation UILabel ( Html ) -( void ) setHTMLText:( NSString *)htmlText{     dispatch_async ( dispatch_get_main_queue (), ^{         NSError *err = nil ;         self . attributedText = [[ NSAttributedString alloc ] initWithData : [htmlText dataUsingEncoding : NSUTF8StringEncoding ]                                                                options : @{ NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType }                                       ...

Intercept Ajax calls in UIWebview - iOS

Step 1 /* Steps to follow 1. Copy the following code. 2. Paste in text file. 3. Save as ajax_handler.js 4. keep this file in your resource folder var s_ajaxListener = new Object(); s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open; s_ajaxListener.tempSend = XMLHttpRequest.prototype.send; s_ajaxListener.callback = function () {     window.location='mpAjaxHandler://' + this .url; }; XMLHttpRequest.prototype.open = function (a,b) {     if (!a) var a='';     if (!b) var b='';     s_ajaxListener.tempOpen.apply( this , arguments);     s_ajaxListener.method = a;     s_ajaxListener.url = b;     if (a.toLowerCase() == 'get') {         s_ajaxListener.data = b.split('?');         s_ajaxListener.data = s_ajaxListener.data[1];     } } XMLHttpRequest.prototype.send = function (a,b) {     if ...