It is possible to display html content in iOS7 UIAlertView? - html

Do you know if it's possible to display some html content (through UIWebView or directly) in the UIAlertview component, on iOS7? The "addSubview" method seems to be no more available...
Thank you for your help!

Unfortunately there wont be UIAlertView with custom views anymore, nor contentView which Apple changed its mind about, you need to use a custom control like a HUD.
A good alternative will be SVProgressHUD, according to many threads in Apple's forum.

Related

HTML table on a UIView in Swift

I am trying to display a table in a UIView that is delivered in html form from a server. It looks like these tables might be slightly different, but they obviously display correctly in a browser.
Is there anyone that can recommend a library that is useful for this?
Thanks for any help.
Edit screenshot of the table cell
The 'textBlock' gets built up with text, images and hopefully tables. All by appending the attributed text. I can't see a way to switch that label out for a webView.
If you want to display HTML in iOS it's better to use WKWebView instead of UIView. Then you can use loadHTMLString method:
webView.loadHTMLString("<html><body><p>Hello!</p></body></html>", baseURL: nil)

Fixing a PDF Accessibility Issue (Alternative description missing for an annotation) when converting an HTML Page to PDF

Currently, I am working on a program that converts an html page into a PDF using the iText Library.
The Checker that I am using is PAC3 -->PDF Accessibility Checker 3 which is described by the following link (https://section508.gov/blog/check-pdf).
One of the issues is the “Alternate description missing for an Annotation”
An excerpt from the following link explains it:
http://www.uottawa.ca/respect/sites/www.uottawa.ca.respect/files/fss-fixing-accessibility-errors-in-pdfs.pdf
Alternative description missing for an annotation This usually happens when the link is not clear enough. To fix this error, add alternative text to the link tags. To add the alternative text, please do the following;
In the tag tree, select the tag for the link, and select Properties
from the options menu.
In the Touchup Properties dialog box, select
the Tag Tab.
Type alternate text for the link, and click close
I have been trying to use iText to fix this problem, but googling, looking at the source and reading the documentation does not help.
Does anybody have any suggestions on how to either write the HTML or use the itext problem to get rid of the “Alternate description missing for an Annotation”
Thank you for your help
You did not specify whether you using old code (XMLWorker, HTMLWorker) or new iText code (pdfHTML).
This of course impacts the proposed solution.
In my answer I am going to assume you are using pdfHTML
There are several options:
edit the incoming HTML using a library like JSoup
convert the incoming HTML to iText IElement objects, and edit those, setting properties where needed
write your own custom TagWorker that handles all instances of a specific tag, and write custom logic to deal with the missing annotations.
An example of a custom tag worker can be found here:
https://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-custom-tagworker-example

Razor- how to display message box?

I am new to Razor. My application is not MVC.
What I am trying to achieve is to inform user that posting data to database was successful.
I do not want to re-direct user, all I want is to display a good looking message box.
I made quite a lot of research and I found these:
System.Web.HttpContext.Current.Response.Write("<SCRIPT> alert('Hello this is an Alert')</SCRIPT>");
and this
Response.Write("<script>alert('Message');</script>");
They both display message but a very bad looking one.
Question:
How to display a good looking message box using razor syntax?
Thank you!
This is the default browser message box, you can't style it.
If you want a nice looking message you need to style a custom one using html/css/JavaScript.
E.g. you could use a jquery-ui see jquery-ui dialog
You cant.
My preference is ALERTIFY JS

Localizing a Google Chrome Web App

I'm trying to add localization support to a Google Chrome Web App and, while it is easy to define strings for manifest and CSS files, it is somewhat more difficult for HTML pages.
In the manifest and in CSS files I can simply define localization strings like so:
__MSG_name__
but this doesn't work with HTML pages.
I can make a JavaScript function to fire onload that does the job like so:
document.title = chrome.i18n.getMessage("name");
document.querySelector("span.name").innerHTML = chrome.i18n.getMessage("name");
but this seems awfully ineffecient. Furthermore, I would like to be able to specify the page metadata; application-name and description, pulling the values from the localization files. What would be the best way of doing all this?
Thanks for your help.
Please refer to this documentation:
http://code.google.com/chrome/extensions/i18n.html
If you want to add localized content within HTML, you would need to do it via JavaScript as you mentioned before. That is the only way you can do it.
chrome.i18n.getMessage("name")
It isn't inefficient to do that, you can place your JavaScript at the end of the document (right before the end body tag) and it will fill up the text with respect to the locale.
Dunno if i understand exactly what you are trying to do but you could dynamically retrieve the LANG attribute (using .getAttribute("lang") or .lang) of the targeted tag and serve accordingly the proper values.

Cocoa: Display HTML from string

How can I display properly formatted text from an NSString, that just happens to be HTML. The html is coming from the stack overflow API.
You can create a NSAttributedString from HTML. You then draw it as you would draw any other NSAttributedString.
If your tags are accurate and you are programming for OS X (or iPhone 4.0+), you can use NSAttributedString's – initWithHTML:documentAttributes:, and then draw that directly.
Unfortunately, the iPhone OS' UIKit does not contain NSAttributedString pre-4.0. The current recommendation from the developer docs is to use a UIWebView, which sucks. An alternative might be the Three20 library, which contains TTStyledText -- that looks like it might do the job.
You could have a WebView, and tell the WebView's mainFrame to load the HTML string.
If you meant to ask about Cocoa Touch, UIWebView has an equivalent method for you.