• Skip to main content
  • Skip to primary sidebar

Ravi Shankar

Tweaking Apps

  • About
  • Portfolio
  • Privacy Policy

Archives for February 2012

How to hide bookmarks bar in Safari on iPad

February 12, 2012 By Ravi Shankar 8 Comments

Safari browser on iPad, like any other PC or Mac browsers allows users to save webpage URL as bookmark. It also provides a separate Bookmarks Bar for easily accessing these saved URLs.

201202120828.jpg

Screenshot with saved bookmarks

201202120831.jpg

If you are not using the Bookmarks Bar on Safari then you have the option to turn off the display of Bookmarks Bar. This would give more space for the web page browsing and you can still access the saved bookmarks using the Safari browser menu items.

Hide Bookmarks Bar on Safari

Navigate to iPad home screen and tap the settings icon. Then navigate to the General section under Safari settings.

201202120839.jpg

Slide the ON/OFF switch to turn off the “Always Show Bookmarks Bar”

201202120842.jpg

Filed Under: Apple, iPad, Safari Tagged With: Apple, Bookmark, hide, iPad, Safari, Turn Off

Code Example – Check for Prime Number Objective C

February 10, 2012 By Ravi Shankar 1 Comment

This is a simple Objective C program written to check whether a number is a Prime number.

//

// main.m

// PrimeNumbers

//

// Created by Ravi Shankar on 10/02/12.

// Copyright (c) 2012 rshankar.com. All rights reserved.

//

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])

{

@autoreleasepool {

  

int number;

BOOL isPrime=YES;

NSLog (@”Enter a number”);

scanf(“%i”,&number);

for (int i=2; i < number –1; i++)

{

if (number % i == 0)

{

isPrime = NO;

break;

}

}

if (isPrime)

{

NSLog (@”%i is a Prime Number”,number);

}

else

{

   NSLog (@”%i is not a Prime Number”, number);

}

  

}

return 0;

}

Output (as displayed in Xcode console window)

2012-02-10 15:53:52.072 PrimeNumbers[1164:707] Enter a number

23

2012-02-10 15:53:58.665 PrimeNumbers[1164:707] 23 is a Prime Number


2012-02-10 15:54:41.469 PrimeNumbers[1176:707] Enter a number

24

2012-02-10 15:54:44.589 PrimeNumbers[1176:707] 24 is not a Prime Number


This program checks whether the number is divisible by any of the n-1 number and if divisible (% operator returns reminder as 0) then the flag is set to false otherwise it is set to true. Then based on the flag value the message is printed to the console window.


Filed Under: Blogging, Develop, ios Tagged With: Objective C, prime number, Program

How to hide header/footer while typing in Excel 2010

February 7, 2012 By Ravi Shankar Leave a Comment

This is in response to question asked by a reader of this blog related with header and footer in Excel 2010.

how do I make the header / footer not visible on the page while typing?

When you click on the insert header and footer option in Excel 2010, excel would immediately change the view to Page Layout. Hence you would see the newly added header and footer in your worksheet.

image

After typing the required header and footer details and do not want to see header and footer while typing you excel sheet in the data section then you can change the view to Normal by selecting Normal under the Workbook Views section.

image

This would temporarily hide the inserted header and footer in the Worksheet and you can always get it back by changing the Workbook view to Page Layout.

del.icio.us Tags: Excel 2010,Header,Footer,Hide,Workbook,Worksheet,Views,Normal,Page Layout

Filed Under: Excel, Excel 2010, Office 2010 Tagged With: Excel 2010, Footer, Header, hide, Normal, Page Layout, Views, Workbook, Worksheet

How to disable code completion suggestion in Xcode

February 4, 2012 By Ravi Shankar Leave a Comment

Xcode is one of the powerful IDE for IOS development and by default it supports code completion suggestion. Code completion feature suggests users with possible code substitution when you start typing first few letters of code in Xcode editor.

201202040829.jpg

For example, if you have UILabel reference variable and start typing “t” after the dot then the above code completion popup will be displayed. Now you can quickly pick up your desired attribute from the list.

In case if you do not prefer the code suggestion and find it more annoying then you can disable this option using the Xcode Preferences.

Click the Xcode menu and select Preferences from the menu list.

201202040832.jpg

In the Preferences window, navigate to Text Editing Preferences then Code Completion under the Editing section.

201202040834.jpg

Unmark the check box with caption as “Suggest completion while typing“. This should turn off the code completion feature in Xcode.

Filed Under: Xcode Tagged With: Apple, code completion, Disable, Suggestion, Xcode

How to set Organization name for Xcode Project

February 3, 2012 By Ravi Shankar Leave a Comment

When ever a new project is created in Xcode, the projects files like header and implementation files will have auto generated comment section at the top of the file. This comment section will have information such as file name, Project name, Author and Organization name.

//

// ViewController.h

// Welcome

//

// Created by Ravi Shankar on 02/02/12.

// Copyright (c) 2012 __MyCompanyName__. All rights reserved.

//

If you have not set the organization name then the default value substituted will be _MyCompanyName_. You can set the Organization name by the following ways.

  • Setting Organization name under File Inspector
  • Updating Company name for the user in Mac Address book

File Inspector

Select the Project in the Project Navigator, then navigate to Utilities section and click the File Inspector icon. Now navigate to Project Document section and enter the company name in field with caption as Organization.

201202031600.jpg

Now if you add any new file to this project then the auto generated comment will have the company name as “rshankar.com”.

Address Book

If you want to retain this organization name for all the future projects then update the company name for the user in Mac Address Book. Launch Address Book, then select the user and update the company name as shown below.

201202031613.jpg

Now when ever a new project or new file is added in Xcode, the Organization name will be set the value provided for company name in address book.

//

// ViewController.h

// OrganizationName

//

// Created by Ravi Shankar on 03/02/12.

// Copyright (c) 2012 rshankar.com. All rights reserved.

//

Please note that any files created before this change will not get affected and you will have to manually update company name.

Filed Under: Xcode Tagged With: Apple, Organization, Xcode

iPad App that prints Welcome Message

February 2, 2012 By Ravi Shankar Leave a Comment

Here is an example of writing an iPad app that prints a Welcome message.

Launch Xcode, click File -> New -> New Project.

New Project

Now select the template for the project as Single View Application.

Project Template

Provide the details for your project, like Product Name, Company Name then choose the device for which you are writing the App. Also mark the check box with label as Use Automatic Reference Counting and click the Next button.

Options for New IPad Project

And finally click the Create button to complete the project creation. Now Open the ViewController.xib file and using the Interface Builder designed add two label controls , TextField and Button as shown below.

UI Interface Builder

Label 1 is used for displaying the caption “Enter your Name”, TextField is used for accepting user input, Display button is used for printing the Welcome message in the second label.

Now edit ViewController.h file and add two IBOutlet elements for UITextField and UILabel and IBAction element for button as shown below.

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

{

IBOutlet UITextField *txtName;

IBOutlet UILabel *lblMessage;

}

-(IBAction) btnDisplay;

@end

Then edit ViewController.m file and implement the IBAction function as shown below

– (IBAction)btnDisplay {

lblMessage.text = [@”Welcome “ stringByAppendingString: [txtName text]];

}

This function creates local string by adding “Welcome ” and suffixing it with the name entered in the Textfield.
After completing the coding part, it is time to connect the UI Interface elements with the Object References in code. Select ViewController.xib in the Project Navigator section then click the File’s Owner under Place Holder section. Drag and drop the respective object references to the UI element and connect map the btnDisplay with the Button Touch Down event. The completing mapping of UI Interface elements with Object References is shown below.
UI Elements and Object Reference Mapping

Now the Run the App in iPad simulator by clicking the Run option on the menu bar or by pressing Control + R on the Keyboard.
iPad Simulator
Now entering the name and clicking the Display button will print the Welcome message as shown below.
Welcome App in iPad Simulator

Filed Under: Apple, Develop, ios, iPad Tagged With: App, Apple, iPad, Welcome

Primary Sidebar

Recent Posts

  • We have blocked all requests from this device – Firebase Phone Authentication
  • iPhone is not available error message in Xcode
  • Clear CocoaPods cache, re-download and reinstall all pods
  • PDFKit – View, Annotate PDF file in Swift
  • Tab Bar Controller with WebView

Archives

  • September 2020
  • April 2020
  • December 2019
  • November 2019
  • October 2019
  • February 2019
  • October 2017
  • June 2017
  • May 2017
  • March 2017
  • September 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • November 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • April 2011
  • March 2011
  • January 2011
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • July 2009
  • March 2008

Copyright 2020 © rshankar.com