• Skip to main content
  • Skip to primary sidebar

Ravi Shankar

Tweaking Apps

  • About
  • Portfolio
  • Privacy Policy

Xcode

How to change page scaling in Xcode

August 15, 2013 By Ravi Shankar Leave a Comment

Xcode provides option to increase or decrease the page scaling. This page scaling option is available as part of the Page Setup. This feature is quite useful when you want reduce the number of pages used for printing any Objective-C code.

201308152115.jpg

The default page scale is set to 100% and you can change this by following the below mentioned steps.

Click File menu and select Page Setup from the menu list.

201308152110.jpg

This should display the following Page Setup screen.

201308152112.jpg

Navigate to the Scale option and change the default value from 100% to say 50%. Then click OK button to confirm and save the changes. Now when you go to print preview screen (Xcode File menu -> Print), you should notice the effect of reduced Scale changes.

201308152118.jpg

Filed Under: Apple, Develop, ios, Xcode Tagged With: Apple, page scale, page setup, Print, Xcode

Reduce the time taken for searching iOS documentation using Xcode

August 1, 2013 By Ravi Shankar Leave a Comment

This tip is for iOS developers who want to reduce the time taken while searching iOS documentation using Xcode. Documentation under the Xcode organiser window by default shows information on OS X as well. If you are not a Mac developer then you can turn off the documentation related with OS X.

Step 1: Launch Organizer window in Xcode and navigate to Documentation tab.

201308012017.jpg

Step 2: In the Documentation window, navigate to the Search Documentation option and click the arrow pointing downwards under the search icon.

201308012022.jpg

Step 3: Now select Show Find Options from the menu list.

201308012024.jpg

201308012025.jpg

Step 4: Navigate to the Find in list box then deselect “OS X 10.7 Core Library” and “OS X 10.8 doc set”.

This would exclude the OS X library while using the documentation search on Xcode.

Filed Under: Apple, Mac, Xcode Tagged With: Apple, Documentation, search, Xcode

Create an example iOS Project using Xcode

June 26, 2013 By Ravi Shankar Leave a Comment

We had already covered the basic overview of Xcode and now we are going see the steps required for creating an sample iOS Project that displays Welcome message on Xcode simulator.

Topics Covered

  1. Create New Project using Xcode.
  2. Add label control to Interface Builder.
  3. Edit label to add Welcome message
  4. Choose simulator in Xcode.
  5. Compile, Build and Run the project in Xcode.

Step 1: Launch Xcode then click FIle -> New -> Project.

201306251050.jpg

Step 2: In the Choose a template for your new project, pick Single View Application under the IOS section and click the Next button.

201306251052.jpg

Note :- We will cover the different templates in detail in future tutorials.

Step 3: Now in Choose options for your new project, enter the name for your project, organisation name and company identifier. In the Devices drop down select iPhone and mark the check box with caption as “Use Storyboards” and “Use Automatic Reference Counting” and click Next button.

201306251100.jpg

Some of the above terms like Storyboards, Automatic Reference Counting will be covered in future tutorials.

Step 4: Specify the location for creating this project and click the Create button.

201306251110.jpg  

Now a new project should be created and you should see a screen as shown below.

201306251115.jpg

Step 5: Select the MainStoryboard.storyboard in the Navigator Pane to access the Interface Builder.

201306251120.jpg

Step 6: Navigate to Utilities section and click Object tab. Scroll down and pick label control from the list then drag and drop the label on to Interface Builder.

201306251123.jpg

201306251123.jpg

Step 7: Edit the label and enter Welcome text.

201306251125.jpg

Step 8: Now select the iPhone simulator under Scheme section in Xcode toolbar.

201306251129.jpg

Step 8: Select Run option on Xcode toolbar or use the keyboard combination of command + R to run the sample project on Xcode simulator for iPhone. command + R will first compile and build the project before launching it on the simulator.

Filed Under: Apple, Develop, iPhone, Xcode Tagged With: Apple, iphone, Xcode

XCode’s iOS Simulator for iPhone and iPad

March 2, 2013 By Ravi Shankar Leave a Comment

iOS Simulator in Xcode can be used for testing iOS apps before trying the apps on a live device. Listed below are the different settings and features on iOS Simulator.

Launching iOS Simulator

iOS Simulator can be launched by executing Program on Xcode

Run Program on Xcode : Keyboard Shortcut is Command + R, Menu is Product -> Run

The screenshot of IOS Simulator is shown below.

201303021038.jpg

Another alternate way to launch the iOS Simulator is by using the menu option under

Xcode -> Open Developer Tool -> IOS Simulator

201303021039.jpg

iOS SDK Version

IOS SDK version of iOS Simulator can be determined by clicking the Hardware menu -> Version

201303021112.jpg

Deleting Apps and Settings

Reset Content and Settings option clears all the apps and settings from the simulator. For example if you have changed the app icon, the new icon will not be displayed unless you delete the app from the simulator and re-run the program.

201303021133.jpg

You can also delete individual apps by clicking and holding the installed apps followed by clicking delete mark just like you do on any iOS device.

201303021135.jpg

Choosing the device screen on Simulator

IOS Simulator allows users to choose different device screens such as iPad, iPad (Retina), iPhone, iPhone (Retina 3.5 inch) and iPhone (Retina 4 inch). You can choose the desired screen by navigating to Hardware menu option and selecting the Device.

201303021206.jpg

It is always recommend to try out the apps on the different device simulator before releasing it on the App Store. For example if you are developing an app for the iPhone then you need to try out in all the 4 iPhone device simulator apart from testing your app on live device.

Taking App Screenshots using Simulator

IOS Simulator can be used for taking screenshots of your app for publishing app on the App Store. This is quite useful when you do not have all IOS devices but still want to see the screenshots of your app. The Screenshots can be taken by loading the app on the Simulator and clicking the File menu -> Save Screenshot. The screenshot will be saved to your desktop in .PNG file format.

201303021146.jpg

IOS Simulator also provides option to copy the individual screen from the simulator using the option available as part of the Edit menu.

201303021200.jpg

Other Hardware features

IOS Simulator has features that lets users to see the behaviour of the app on each action such as Rotating Screen to Left, Rotating the Screen to Right, Shake Gesture, Accessing the Home Screen, Locking the Device and also simulating low memory warning.

201303021214.jpg

Simulate Locations

Location menu option under the Debug menu is quite useful for development of location based apps. This lets developers to simulate location required for testing their app.

201303021218.jpg

iOS Simulator Screen Zooming

IOS Simulator screen size can be increased and decreased based on your need using Window -> Scale menu option.

201303021222.jpg

Filed Under: Apple, Develop, ios, iPad, iPhone, Xcode Tagged With: Apple, iOS Simulator, iphone

How to rename default view controllers in XCode

June 11, 2012 By Ravi Shankar Leave a Comment

Xcode by default provides default name for the view controllers depending upon on the selected projects templates. For example, while creating Tabbed Application, you will find FirstViewController and SecondViewController as the name for default view controllers.

NewImage

Now if you want to provide a proper name to the FirstViewControllers and SecondViewControllers you can use the Rename option available under the Edit menu.

To rename FirstViewController,  

Step 1: Navigate to FirstViewController.h and select the name after interface keyword.

NewImage 

Step 2: Click the Edit menu then Refactor and select Rename from the list of available option.

NewImage

Step 3: Enter the name then select Rename related files and click the Preview button. This would display the list of files and location where the rename would affect.

Step 4: If you are happy with Preview then save the changes.

NewImage

By this way you can rename the default view controller and their related files (.h, .m and XIB) in Xcode.

Filed Under: Xcode Tagged With: rename, view controllers, Xcode

XCode – Open file in same window on double click

June 2, 2012 By Ravi Shankar Leave a Comment

Xcode by default displays project file in a seperate window when the user double clicks on the file. And if you want to change this behavior and to open the file in the same window as that of single click then you can use the options provided as part of Xcode Preferences.

Step 1: Launch the XCode Preferences, XCode menu -> Preferences or ? + ,

Step 2: In the General tab, navigate to Double Click Navigation option.

XCode double click

Step 3: Select Same as Click value from the drop down list.

Now when a user double clicks on a file, XCode will display the file in the same window.

Filed Under: Xcode

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

  1. Pages:
  2. «
  3. 1
  4. 2
  5. 3
  6. 4
  7. 5
  8. 6
  9. 7
« Previous Page

Primary Sidebar

TwitterLinkedin

Recent Posts

  • How to know the size of the folders in iCloud
  • Errors were encountered while preparing your device
  • 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

Copyright 2021 © rshankar.com