Select Page

I discovered a few neat tips that I will share with you here to help you when you are programming iPhone or iPad apps in Xcode. Check it out!

The first tip is the ability to use special characters in your app. If you have an element on a View like a label and you want to put a special character but you don’t want to use an image then you can go to the Edit – Special Characters menu.  You will see there are a number of categories that you can select including Arrows, Currency Symbols, Math, Bullets/Starts and even Emoji’s! Once you find the character you would like to use then, double click and the special character gets placed on the element.

You can see that a return character was placed on a label by using this method. This can be a very useful way to add to add some neat characters to your app without any special graphics.






A second tip allows you to see all of the connections associated with a particular element on your View. For instance if you wanted to see all of the connections associated with the return key, you would right click on the return key label. By looking at the window displayed, you can see all there are two actions being fired on the Touch Up Inside Event. If this is not what you intended, you can hover over the action you don’t want then click on the X to the left of the action name to remove it. This is very helpful to actually see what is occurring in your app and help you troubleshoot and fix any issues.

A third is a visual tip to see what is associated with an action or outlet in your View Controller code. If you look carefully you will see little round circles on the same line of the first line of code in the left gutter of the code editor for each of your actions and outlets in your View Controller. If you hover over each of those small circles with your mouse then the control on your story board will highlight showing you the control that is associated with that particular outlet or action. The mouse below is hovered over the enter @IBaction Event and you can see that it is associated with the enter label on the storyboard. This is another good tip to help you see what piece of code are associated with controls starting from your code side and help you troubleshoot if something is not behaving the way it needs to in your project.

The last tip will help you with issues with your constraints. If you are seeing yellow lines for any of your controls on your Storyboard, then XCode is telling you there is an issue with a constraint and it doesn’t know what you want to do with the control. To fix this you need to click on the little icon on the bottom left of the Storyboard which is called the Document Outline. When you click that icon you will get an outline view of your UI.

There is a little yellow circle that appears in the top right of the Document Outline which indicates there is an issue with your UI. If you click it Xcode will list of all your issues with your UI. In this particualr case the label is too high, it was expecting the height to be 39px but it is 57px.

A good reliable way to fix an issue like this is to click on the little yellow triangle to the right of the issue. Leave the first option Update Frame selected and click on the Fix  Misplacement button. This first selection tells Xcode to take all of the constraints rules and move and/or resize this label to where it should be to fix the issue. Once you do that, you will see the No Auto Layout Issues message displayed in the Document Outline window and there will no longer be the yellow lines around the control that had the issue.

That’s it for this post, hopefully this will help you with any layout or odd behavior your app is having when you are building your iPhone app. Let me know what you think by leaving your comments below!

Share This