I’ve spent some time trying to figure out why my pushed view controller was doing a funny animation instead the simple right-to-left animation. It seamed as if the view of the pushed view controller was treated as a layer and the setting of the views frame was done with an animation.

The problem turned out to be, that this pushing was done in an on complete of a dismissViewController:

[navigationController dismissViewControllerAnimated:YES completion:^{

    FunkyViewController *myFunkyViewController = [[FunkyViewController alloc] init];

    [navigationController pushViewController:myFunkyViewController animated:YES];


The instantiation inside the completion block caused the loading of the view being done inside an animation transaction, which caused the setting of the frame as an animation…

Solution to this, just instantiating outside the completion block


FunkyViewController *myFunkyViewController = [[FunkyViewController alloc] init];

    [navigationController dismissViewControllerAnimated:YES completion:^{

    [navigationController pushViewController:myFunkyViewController animated:YES];


You can view Testflight sessions with an app in production that has an Enterprise profile by:


1) Compile and distribute with your normal In House profile

2) On your archive, distribute this same archive with you Ad Hoc profile

3) Save ipa and xarchive to a save location

4) upload ipa to Testflight via web (I’ve done so many test that I don’t know at this point if it matters if it is desktop app or web, at least I know that web works)

5) Right click xarchive > Show package Contents > dSYMs  copy your desym near to your ipa

6) Upload your dSYM file to the crashes section of your build on Testfligth


I was having troubles showing a simple MPMoviePlayerViewController… digging into stackoverflow everything pointed me to an issue of iOS 6 about rotations, and viewWillAppear/viewWillDisappear methods that are called from the root view controller.

What it actually was… was much more simpler than all this (now… after 2 hours of research..), this stackoverflow answer pointed me to the correct solution


I was using

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];

instead of:

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];

This is how it should look like

NSString *path = [[NSBundle mainBundle] bundlePath];

path = [path stringByAppendingPathComponent:@"test.mp4"];

self.moviePlayerViewcontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];


Worst thing…  the error messages: NOTHING AT ALL

Imagine you have a repeating animation created with the UIView block animation method and you want to stop.

So your creation looks like this:

[UIView animateWithDuration:2.0 delay:0.0 
    [myImageview setAlpha:1.0];
}completion:^(BOOL finished){

You can just stop this animation by  commiting a fast animation to the final value you want to have, in my case alpha 0

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:0.1];
[UIView setAnimationCurve: UIViewAnimationCurveLinear];
[myImageview setAlpha:0.0];
[UIView commitAnimations];

source: http://stackoverflow.com/questions/554997/cancel-a-uiview-animation

source that didn’t work for me, as first guess because I am using an UIImageView:


As the title of this post says, in other words xCode freaking out because you deleted/renamed/moved a file in Finder and not in xCode it self. And svn freaking out because the files have @’s in there names. Googling around and stackoverflowing I read out that xCode adds the files to svn automatically once the file is added to the project. And svn uses the @ internally for revision names.

In terminal it is quite easy to resolve, first if you want to see the status of each of the files you can type the command: svn status. All of the files that have an exclamation point at the beginning of the path were added to svn but removed/renamed/etc before committing to svn.

This post explains it quick and simple. You can revert each one of those by typing

svn revert [path_to_the_file]

And this stackoverflow answer explains very well how to deal with filenames containing @’s. Quick answer here: svn only takes care about the last @ so if you have for example icon@2x.png you just need to type in terminal following the previous example:

svn revert icon@2x.png@




My previous post was a quick one to rescue a great post for editing font info with TTX FontTools.

I had the need of this tool because I was having troubles to make a UILabel getting the fontweight bold of a custom font of my current project. My project has a specific font with different weights, so different files and there was no way to make my UILabel getting a bold weight.

I tried to add a “-Bold” to the fontName, like this:

[UIFont fontWithName:@”Name of the font-Bold” size:15];

But this didn’t really work. With TTX I wanted to change the font name of family name so that I could just use a completely new one. What I realized with the xml generate from TTX is that the fontName wasn’t really the one displayed in FontBook window (on MAC).

In the xml try to use the font name under the item:

<CFFFont name=”MyFontName-Bold”>

This one is the that works with iOS labels!

This is a quick post mainly for me but may be useful for any other person. There was a great post in blog fontgeek.net which illustrated how to use TTX FontTools to edit any data of a given font. Fontgeek.net doesn’t seem to be operative anymore so I wanted to rescue this post for me and for anyone else who needed to know how to use this great tool. I am directly copying this post from the google cache so I hope the original author is ok with it, in case not please let me know and I can remove or unpublish this post, or add any reference to the author.

Installing TTX for the command-line challenged

In an earlier post, we showed you how to use TTX, an open source font editor, to rename a font in order to avoid font conflicts. This can be helpful because your operating system and your applications recognize fonts by name and name alone, and on occasion you may need to activate a font which conflicts with an installed system font. So even if you have two very different versions of a font, but they have the same name, the operating system cannot discern between them.

The biggest hurdle for most people, is that TTX is a command line tool, which adds one layer of difficulty, but the method of installation, which is very obvious to those acquainted with Python, is not readily apparent to the technologically challenged. But once the steps are explained, and carefully followed, you will get access to a powerful tool for editing fonts.

Why TTX?

First, TTX is free.

Secondly, when you process your fonts using TTX, there is no behind the scenes mystery to what is happening with the fonts. TTX is a tool to convert OpenType and TrueType fonts to and from XML. You could use tools like FontLab Studio or Fontographer to make changes to your fonts, but it is not always transparent what is happening to your fonts during this process. In short, changes made in those applications may include something you not readily apparent in the processed font. TTX is the least invasive option for those seeking to make simple (and sometimes very complex) changes in your font files.

Getting started

First you will need to have Xcode installed, and a download link to the version you require can be found here. Make sure you download the correct version for your OS, as the development tools for Snow Leopard cannot be installed on Leopard.

Then download TTX. A link to the files needed can be found here. Once downloaded, decompress the file and move the folder to the root level of your hard drive.

Next, launch Terminal, which can be found in the Utilities folder in your Applications folder.

Then at the prompt type “cd” (no quotes) and a space, then drag the fonttools folder onto the Terminal window. Terminal will automatically add the path to the folder, which saves us from possible typing errors. What you entered should look something like the line below:

cd /fonttools-2.3\ 3

If you would like to see a list of the contents of the folder in Terminal, just type “ls” (once again, no quotes) at the prompt, or just open the folder in Finder.

Now in Terminal, type the line below (or copy and paste)

sudo python setup.py install

What this command does is run the installer in the fonttools folder (setup.py). The command “sudo” (pronounced soo-doo) means you are running the command as the superuser, which is a special user account used to administer your Mac (or any Unix/Linux system). Because you are running the command as the superuser, you will be required to enter an administrator password. The item “install” is an option telling the setup script what to do.

After you have the command inserted at the prompt, hit return, then enter your password and hit return again.

If all is well, the Terminal will spit back a bunch of information describing what the script is doing, mainly that it is moving files to the locations needed to run TTX.

You are ready to roll

Once installed, your are ready to run TTX. To find out the options you can use with TTX, just type in “ttx” (still no quotes) in Terminal and it will list them all.

There are a lot of things you can do with TTX, including the post mentioned earlier on how to rename fonts with TTX here.

Hopefully, this article lowered a barrier of entry for those looking to work with TTX. It is a powerful tool, and like all powerful tools, it gives you the capability of really messing things up, so always back up your font files before getting too deep in editing them.

Aug 27 NO comments

Using TTX to rename fonts

One of the most problematic issues associated with font management is how to manage font conflicts. Font conflicts come about when you activate a font with the same name as a font that is currently activated. If you have seen an alert like the one below you know what I am talking about.


Your operating system and your applications recognize fonts by name and name alone. So even if you have two very different versions of a font, but they have the same name, the operating system cannot discern between them.

This font name has nothing to so with the font in question’s file name. If the issue were that easy we could rename fonts in the Finder and the problem would be solved. It just isn’t that easy.

There are tools available that allow you to rename a font, such as FontLab Studio or Fontographer, but those tools can be cost prohibitive and oftentimes might not be worth the investment to make changes on just a handful of fonts.

There is an option in the open source world that can help. FontTools/TTX is a tool that converts OpenType and TrueType fonts to XML and back again. You can download FontTools/TTX here.

FontTools/TTX is a command line tool that once set up can be very easy to use. In our example we are going to use an OpenType version of Helvetica Neue Roman.


Ordinarily, activating this font in a third-party font manager would result in an alert that the font conflicts with the Helvetica Neue font that resides in the /System/Library/Fonts/ folder. What we are going to do is change the internal name of the font so it will no longer conflict with the system version of the font and can appear in our font menus, along with the system version of Helvetica Neue.

Since TTX is a command line tool, we will need to launch Terminal, which is found in the Utilities folder in your Applications folder.

Once you launch Terminal, type “ttx” (no quotes) and  space, then drag the font from the Finder into the Terminal window. Terminal will automatically add the path to the font file. The results in in the Terminal will look like the screenshot below:


Once the path is added, hit return. TTX dumps the font tables into XML and saves the file in the same folder containing the original font.


This new .ttx file can be viewed in any text editor. In our example we are going to use TextEdit.

Once the file is open in TextEdit we need to find the name of the font. The quickest way to find this is to search the document for “fullname” (no quotes). If your search is successful you will find a line like the one below:


This is the name of the font as it appears in the font menus.

The next step is to carefully select the font name inside the quotes. Then, we want to replace all the instances of where the previous name is referred to with our own. I opted to annotate the name with two letters “FG,” so the new font will be named “HelveticaNeueFG” and appear in our application’s font menus as such.

In order to do this we use TextEdit’s Find and Replace feature to change every instance of the name as shown in the screenshot below:


Once you have entered our search and replace criteria, select “Replace All.”

Note: If your font has a name that would commonly be used in a font file such as “Glyph” or “Asterisk” you may get some unwanted text replacement and possibly produce an unusable .ttx file. In these cases you should manually scroll through the font file and replace the instances where the name listed.

Then save the file. Make sure it is saved as plain text with the extension .ttx. I also opted to change the font file name in order to differentiate the font from the original in the Finder.


Because TTX is smart enough to know the difference between a font file and an XML file, we can run the same command we used earlier to convert the XML file to a font. To do this, Open Terminal, type in “ttx” (no quotes) at the prompt with a space, then drag the newly created .ttx file into the Terminal window.


TTX converts the XML to a new OpenType font file in the same folder as a .ttx file.


The newly created font can be added to one of your system font folders or to a third-party font manager and be activated without conflict.

The font will now also appear in your font menus under it’s new name, as it appears in Adobe InDesign in the screenshot below.


While this is not an ideal solution, and there are certain problems that will be created  if you rename fonts in this manner (such as possibly violating the terms of your font license agreement), this is one way to address issues such as one reported in an earlier FontGeek post concerning Snow Leopard, InDesign and Helvetica Neue.

Note: I mentioned earlier in this post that TTX is easy to use once it is installed. I did not have any luck using the binary installer available on the download page and only got the app installed after downloading the source files, running the python install script, then running TTX and moving the files to the locations required on the drive as I ran into error messages. While this was somewhat difficult, I did get it to finally run.

Another Note: Since this article was posted, we have added a new post that guides you through the steps of installing TTX that hopefully will take some of the pain away. That post can be found here.

I have been now with this issue (well not an alternativa issue but of my own mind).

How to get the view in Alternativa3d resized without resizing the object. Actually the objects aren’t resized it is the field of view (fov) that modified when the width and the height of the view is setted.

There are a lot of explanations to read and really good indications, but not exactly the solution to my problem, although a really good tips. This post explains really good how fov works and wich relation you have to mantain with the distance to get the scale 1:1. It helps when you have an object at point (0,0,0) and a no moving camera. The formula is:

D / F = tan(FOV/2)

Where F (Focal length), D (is the half diagonal of the view), FOV (field of view).


(I am using the same image as in the forum post of Alternativa3d it really helped me a lot si I hope nobody gets offended by this….)

That means, to have the correct scale of the object the focal length would be the position of the camera z, having the viewing object in position (0,0,0). So the adjustment to the camera when the view gets resized should be:

FOV = 2 * arctan(D/ F)


private function setFieldOfView():void{

var halfDiag:Number = Math.sqrt(view.width * view.width + view.height * view.height) / 2;

var dist:Number = Math.abs(camera.z);

camera.fov = 2 * Math.atan2( halfDiag, dist);


And that should always be setted when the view is resized. This works fine until you have scene where you move around with the camera. With this if you move the camera the relation to the objects scale is correct, until the view is resized. That is because this function is forcing the field of view, to see the object in scale 1:1. So, although you have moved the camera and the user would expect to see the object bigger/smaller it is in almost the same size.

Realized this the first thing that came in mi mind is that I should be changing not the fov but the focal length of the camera, well Alternativa doesn’t give this option.

So, when you change a camera’s FOV or view’s dimensions, the focal length is recalculated to match the previous expression

And of course changing z position of the camera to accomplish the 1:1 was not an option because I wanted to have the camera traveling around the scene. So there had to be something I didn’t really understand…

Due to focal length’s change objects on a screen change their scale accordingly. So, all you have to do to prevent objects’ scale changing is to keep value of the expression D / tan(FOV/2) constant, i.e. when you change FOV, adjust view size and vice versa.

How could I mantain the focal length constant in relation to the FOV and the view size if I couldn’t change the focal length of the camera? For me the focal length was kind of a distance between the object the camera was looking at and the camera. And actually it is in kind of a way. Although it is a relation not a fisical distance. So the post already said it Mantain the value of the expression D / tan(FOV/2) constant in other words mantain the focal length constant. So know I just put a constant as focal length:

private function setFocalLength() : void {
var halfDiagonal:Number = Math.sqrt(view.width * view.width + view.height * view.height) / 2;
camera.fov =2 * Math.atan2(halfDiagonal,FOCAL_LENGTH_1_1);

So, the position of the camera in front of each object, to see the object in scale 1:1 should be in a distance from it of FOCAL_LENGTH_1_1.