Different sections in a view in iOS - ios6

I want to achieve something like the next image at the bottom. Three sections which I can change touching in each option (DescripciĆ³n, Video and Afiche). I don't know which UI components should I use according to iOS patterns and components. My workaround to achieve it would be use three buttons and when the user touch any of them I should hide the current view and show other view. Should I do my workaround or do you have any other suggestion? I'm developing from iOS 7. Thanks.

My solution was to use a UISegmentedControl to switch between views. I'm using a WebView and when user change between options I just change the WebView's content.
Assign selector to the UISegmentedControl
[_segmentControl addTarget:self action:#selector(segmentedControlClicked:) forControlEvents:UIControlEventValueChanged];
Method to change between views
-(IBAction)segmentedControlClicked:(id)sender
{
if([sender selectedSegmentIndex]== 0 )
{
[_webViewContent loadHTMLString:desc baseURL:nil];
}
else if ([sender selectedSegmentIndex] == 1)
{
[_webViewContent loadHTMLString:html baseURL:nil];
}
else if([sender selectedSegmentIndex] == 2)
{
[_webViewContent loadHTMLString:desc baseURL:nil];
}
}

Related

Zooming a qooxdoo widget

I have a qx.Desktop application which is used on mobile devices. Some of the content in my application should be zoomable by pinching. So my question is: Is there a way to zoom a qooxdoo widget like for example a qx.ui.basic.Image bigger and smaller?
The page zooming is configured through the meta tags of your index.html .
If you want to "zoom" or "pinch" one single widget you can use
http://demo.qooxdoo.org/current/apiviewer/#qx.bom.element.Transform
and use the scale method.
You can access the DOM element through getContentElement().getDomElement()
Here is an easy example:
var div = yourLayoutElement.getContentElement().getDomElement();
if (div !== undefined && div !== null)
{
div.style.zoom = scale;
}
a scale of 1.0 is 100%

How to render (in pdf) responsive pages in PhantomJS

I'm wondering how to render responsive pages using PhantomJS in pdf format.
I have tried so many responsive pages and found that it is printing the pdf using the print css.
So, if the page includes the print css OR screen only css it will render the pdf same as we found via print command preview (Ctrl + p).
Is there any way OR script by which i can get the pdf as I'm seeing them on web browser?
Attaching the file when i tried to get the pdf from http://getbootstrap.com/examples/jumbotron/.
Also the main issue is not responsive designes, the issue is print css applied over them.
example pdf
jorupp came up with a javascript solution in this gist. It essentially let's you "lock" all the media queries in the document's stylesheets to whatever applies presently, before changing to print mode.
In case the link ever disappears, here's the code:
function process(rule) {
if(rule.cssRules) {
for(var i=rule.cssRules.length-1; i>=0; i--) {
process(rule.cssRules[i]);
}
}
if(rule.type == CSSRule.MEDIA_RULE) {
if(window.matchMedia(rule.media.mediaText).matches) {
rule.media.mediaText = "all";
} else {
rule.media.mediaText = "not all";
}
}
return rule;
}
for(var i=0; i<document.styleSheets.length; i++) {
process(document.styleSheets[i]);
}
This is quite tricky since there is no option to tell PhantomJS to use the screen when rendering as PDF.
You would need to
load all the linked stylesheets that contain a print block with __utils__.sendAJAX,
remove #media print block (this is quite hard with regex because you need to look out for balanced braces, but relatively easy with plain JS),
maybe you even need to rename #media screen to #media print,
remove the linked stylesheet from the document and
add a style element which has the manipulated stylesheet inside (preferable in the same place as the previous stylesheet) to the DOM.
Your page won't look good, because you usually have page breaks and the like with pdf. Also, page width and viewport width are quite hard to get right. Changing the page width doesn't change the viewport, so it won't be the proper responsive that would have with a pixel perfect png. But that is only a solution if you don't need selectable text.

Using screen.width and window.devicePixelRatio to detect mobile and/or retina displays is this a bad approach?

I'm developing a website for a business. It's not a web application by any stretch of the imagination but I would like it to look ok on mobile devices rather than simply scale the desktop version. After lots of research into media queries and responsive/adaptive design approaches my requirements are that the mobile layout only kicks in when the user really is on a small screen and not just resizing their desktop window, the solution is simple and can be accomplished with media queries and minimal javascript.
The approach I've come up with is something like this:
<script type="text/javascript">
var isRetina = window.devicePixelRatio > 1 ? true : false;
var isMobile = (screen.width < 768) ? true : false;
if (isMobile && isRetina) {
SHOW MOBILE LAYOUT AND HI-RES IMAGES
} else if (isMobile && !isRetina) {
SHOW MOBILE LAYOUT AND LO-RES IMAGES
} else if (!isMobile && isRetina) {
<<SHOW HI_RES IMAGES>>
} else if (!isMobile && !isRetina) {
SHOW DESKTOP LAYOUT AND LO-RES IMAGES
}
</script>
Before I commit to this approach I figured I'd check in and see if there is a problem or a terrible gotcha awaiting me. Or if there's an even simpler/better way to achieve this goal. I've searched a bunch on SO an haven't seen any mention of using this exact same solution.
The reason javascript is not a preferred method when loading CSS layouts is because javascript is usually the last thing loaded when the browser renders your page. This means that for a flash second you'll see your initial layout on the screen, before it loads the correct CSS. The simplest and most ideal approach is to make use of CSS3 Media Queries (something like this simple tutorial could go a long way: http://webdesignerwall.com/tutorials/responsive-design-in-3-steps).
The other option you have is to use Modernizr to load your stylesheets or other files that you may want to load based on viewport sizes. Look into the Modernizr Doc, you can basically "test" for the functionalities and features on the current browser that's being used to view your webpage - and load files accordingly. As a side note, Modernizr is a JS library so again use with caution when loading CSS files - it's known to load them without the splash screen of your initial layouts but I'd still say the best practices for loading layouts based on media queries is to use the CSS3 media queries themselves.
sorry to post to answer, couldn't add comment.
window.devicePixelRatio on firefox (and i believe Mac) will be bigger than 1 if you zoom in, which could result in a bug
navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)
this might help

DotNetNuke 'TrueFalse' profile property labels

By default, DotNetNuke 'TrueFalse' Profile Property displays two radio buttons with 'True' and 'False' labels. Is there a way to rename these labels so that they say something like 'Yes' and 'No', for instance?
Like this: http://img837.imageshack.us/img837/5773/profileproperty.jpg
It seems a little bit odd that user profile properties have boolean labels, so I'm assuming this must be somehow customizable. I just can't see how...
Customizing almost any label in DNN is done through the localization (language) features in the portal. I would look on the wiki on the DNN site for specifics (I am not sure where the labels you are looking at are)
You can do by setting or just change the TrueFalse data type default label using jquery.
I have used the same procedure for one of my project.
var genderCount = 1;
$('#dnn_ctr632_Register_userForm_a304ec533c1ae2f23db908fa1cc294c5 .dnnFormInput').each(function () {
if (genderCount===1)
$(this).html('Women');
else {
$(this).html('Men');
}
genderCount++;
});

Override custom content page markup Drupal 7

Although I've seen some 'clean' answers on this topic here, it still doesn't work in my case, which is the following: being in Drupal 7 with a completely customized theme, I have created a custom content with the machine name cco_product. I want to override the page markup for the page generated for this content type. I have tried, as per the documentation,
page--cco_product.tpl.php in the tmemes folder, based on /module/system/page.tpl.php, but my Hello world on top of this file doesn't show up.
Thanks for help
First, try clean your cache, if did't help, i can advise to look into the an array of templates for your page. Maybe one of your modules or your custom theme overrides array of templates like this:
function MYTHEME_preprocess_page(&$variables, $hook) {
//Add multiple suggestions for pages based on Node
if(arg(1) == 3) { //For node 3
$variables['theme_hook_suggestions'][] = 'page__contact';
} if(arg(1) == 4) { //For node 4
$variables['theme_hook_suggestions'][] = 'page__about';
}
}

Resources