Few tips on JavaScript – Part II

This blog is a continuation of my last posting.

Solve the pass by reference problem in JavaScript
Many of us has come across the pass by reference problem in JavaScript array. we have simply assign one array to another array and any modification in one array reflects both the arrays and we bang our head where it is got changed.

var myArray=["test","nice","great"];
var changedArray=myArray;
changedArray[1]="chnagedValue";
console.log(myArray);
console.log(changedArray);

Continue reading

Few tips on JavaScript – Part I

Properties in double quotes

var myArray=["test","xyz","great"];
console.log("MyArray Length (Without Quotes)="+myArray.length);
console.log("MyArray Length (With Quotes)="+myArray["length"]);

Output
MyArray Length (Without Quotes)=3
MyArray Length (With Quotes)=3

Description
As we know that we can access Array properties by array name with dot notation. But we also can access the array properties through the array square bracket within the quote. The array operator (square brackets) is also used for accessing the array’s properties (arrays are also objects in JavaScript) .So we can access the array length property within the quotes in the array square bracket. Continue reading

Hiding status bar while displaying splash screen in PhoneGap iOS application

Introduction: Most of the iOS application starts with the splash screen with the spinner which makes the sense that application is loading it’s required files and resources. But if you focus on the screen, you will find that while showing the splash screen, some part of the splash screen is hidden by the status bar.

Description: If we want to hide the status bar while showing the splash screen, it is very easy and we can view the splash screen completely by ignoring the staus bar above it.

Here is the the simple technique bellow.

1. Open Xcode and click on the project in Project Navigator.

2. In the target panel select the project and it will open the project details.

3. Choose the general tab form the list and we can find the Development Info panel in the list. And in Development Info there will be an option for Status Bar Style.

4. Then we need to tick the check box for “Hide during application launch”. Continue reading