Monday, December 8, 2014

iOS Development Tips & Tricks

New iOS version there are a bunch of new tips and tricks to work out. Here a few things that weren't immediately obvious to me, it is in no way a complete set.

1)  Who Committed a certain line - GitHub

Working on a project with multiple people and discovered a bug, There is an easy way to see who was responsible for committing it using Xcode’s advanced source control features.

Right click on the line and click on “Show Blame for Line”

Screen Shot 2014-12-08 at 10.13.02 am.png

Once you click that, you should see the person who committed the line along with the commit message.

→ You can see the diff between your working copy and the revision when that particular change was committed or see the “Open in Blame” for the entire file.

Screen Shot 2014-12-08 at 10.24.53 am.png

You can see log history the same view by long clicking the “Version Editor” button at the top-right in Xcode.

Screen Shot 2014-12-08 at 10.52.33 am.png

Finding methods in a huge file can be a tough task, especially if you use the usual Find option and have to jump over all the method calls to finally arrive at the method definition.

There might also be cases where you don’t know where a method is declared or defined. In such situations, you can use the the “Open Quickly” search box, which can be opened by pressing Command (⌘) + Shift + O. Just start typing in the method name, and it should start giving you suggestions, narrowing down the results as you type.

Screen Shot 2014-12-08 at 11.55.18 am.png

3) Preview Editor

The Preview Editor now allows you to view multiple previews of different simulated devices side by side. Not only can you see how your app looks on different devices, but you can also set each of the devices to be in either portrait or landscape mode. This provides a fast way to preview your app's user interface on different devices and orientations without first running it.

Let us look at the steps on how to use auto-layout for both iPhone and iPad application development in Xcode 6 by using default “Inferred” view.

  1. Open Xcode 6.
  2. Select Single View Application and create new project in Xcode.
  3. Give Project Name as UniversalDemo
  4. Choose Language : Swift/Objective – C
  5. Select Device : Select Universal
  6. Now in project navigator you will find “Main.Storyboard”.
  7. Select “Assistent Editors on Right” in View

Screen Shot 2014-12-08 at 12.21.54 pm.png

  1. Click on “Main.Storyboard”, select View Controller you will see “Attribute inspector” in “Utility Area”.

  1. Select Manual → Preview → Main.Storyboard.

  10. Drag button to the center of view controller. You can check how button  will be displayed in different device using Assistant editor without running the application.

Screen Shot 2014-11-24 at 12.40.23 pm.png
(Look at the different size of screen 3.5 inch, 4 inch, 4.7 inch, 5.5 inch, iPad)

1 comment:

  1. Xamarin apps use native UIs on every platform to enable the best possible experiences. Simplify mobile app design with our Android and iOS designers, and build your own app today.​iOS Tutorial