Skip to main content

Add a multi-language slideshow to your WordPress Home Page using Meta Slider plugin

One of the most frequent questions featured by the official support forum is about adding a slideshow-type image gallery to a WordPress-powered home page, possibly also localizing its contents for multiple languages. This brief tutorial shows how to do that using the well-known Meta Slider plugin, one of the most used slideshow generators, yet you can achieve the exact same results with any slideshow plugin supporting shortcodes (never heard about them? read here).

Read More

Objective-C: Programmatically set UIView alignment without using Storyboard

I recently wrote an article about removing Storyboards constraints programmatically. When you do that, you’ll often also want to replace the removed constraints with new ones: you can do that – programmatically as well – by using the addConstraint method, which allows to set one or more constraints between any two UIView items.

Let’s see some example by taking a standard UIButton item as the first object and its Parent View (or superview, as it is called by Objective-C) as the second one.

Read More

Android Studio: customize the “back to parent” ActionBar icon image (homeAsUpIndicator)

Like you probably already know, the ActionBar of an Android App can be set to allow backwards navigation from a child Activity to its parent, assuming that the relationship has been properly configured in the AndroidManifest.xml file:

We won’t go any further: for a full reference guide to Backwards / Up Navigation we strongly suggest reading the official documentation. We’re just pointing out that, in order to show the “up to parent” icon, we need to set up the  setDisplayHomeAsUpEnabled()  method accordingly:

This simple command will bring the backwards navigation icon into the leftmost side of the activity ActionBar

In order to replace the default theme icon with a custom drawable image we need to add the following declaration to our theme xml file:

The theme file location may vary: it can be  /values/styles.xml  or   /values/themes.xml  or even another file, depending on your app project configuration. Also remember that, if you are supporting pre-11 APIs, the above declaration should be put into the theme file located into the  /values-v11/ folder, whileast the theme file in  /values/  would require the old API style syntax instead:


Here’s a couple .rar archives containing some homeAsUpIndicator icons you can use to replace your theme‘s default ones: they are both white, so they could be a nice fit if your ActionBar features a black or dark-colored background color.

Happy coding!

XCode: set Status Bar style and color in Objective-C

Starting from iOS7 the status bar style can be modified in two different ways or, to say it better, with the following scopes:

  • per-Controller, meaning that each controller will be able to have a different status bar style.
  • per-Application, meaning that we will set a single style/color set that will be propagated in each controller of the Application.


This is the default scope for iOS7+, meaning that the framework expects that we’ll do our modifications inside each controller code file. In order to obtain such a result we need to add the following piece of code in the viewDidLoad method of our controller.m file:

Then we just need to implement the preferredStatusBarStyle method, returning the status bar style we want to use for this view controller: for example, if we have a dark background we would definitely like to set up a light content like this:

If we have to deal with a light background we could better use the default style, which features a dark content:

And so on.


If we want to have a single status bar style/color for any of our controllers, the first thing we have to do is to change the default settings. In order to do this we have to add a specific key to the Application’s Custom Target Properties. These can be accessed by manually editing the info.plist file in the /Supporting Files/ folder or, using the GUI, by selecting the main application Target and then navigating through the Info tab:

Two different ways to achieve our goal: reach the Custom Target Properties.


Here’s the key/value we need to add:

We can check the results of our changes by looking at the XCode user interface:


Once we did that we just have to add the following piece of code to the didFinishLaunchingWithOptions method inside the AppDelegate.m application file:

If you want to go further in styling your Status Bar we highly suggest to:

Happy reading and happy coding!



Android: proportionally stretch an ImageView to fit the whole screen width while maintaining its aspect ratio

Proportional image resizing is a fairly common scenario while developing an Android app: there are a number of situations where you might want an image to stretch itself to horizontally fit the whole screen while keeping its original aspect ratio. You might think it should be easy: sadly, it’s not.

The problem

Achieving this result in HTML would be extremely easy: we just need to set our image width to 100% and avoid to set any height, letting the browser doing the whole proportional resize job. Unfortunately, Android wears a different pair of shoes: the ImageView element containing your drawable resource (or downloaded file) requires a width and an height: we can give a fixed number in px, dp or other supported units, use the parent width with the match_parent command or use the actual image width using the wrap_content command: as we can see, proportional resize is not an option. We can achieve some decent results by setting android:layout_widthandroid:layout_height and android:scaleType to make them adapt to the container layout in the following way:

These values could work in your specific scenario, but they tend to give inconsistant results among different devices and, most importantly, among different image sizes/ratios.

The solution

Why should we use a plain ImageView? We can start by taking a look to this interesting post on StackOverflow showing how to extend a View in order to achieve a very similar result: then we can use that knowledge to build our own ImageView extension class. Here’s an example of a ProportionalImageView which automatically scales its height according to its computed width keeping its original aspect ratio intact:


And this is how we can use it inside an XML layout:

Just remember to replace with your app namespace and you should be fine.

Happy coding!