A few weeks ago I published my first contribution to CocoaPods. It is a library to draw line graphs on a plot.

I wanted something really easy to use, where you just drop some values and the library does the rest. Calculates nice axis values, functionality for logarithmic plot, linear plot, value changes animated or not, dashed/dotted/solid lines, filled or not, etc.

All this in a very “Apple style” library, with delegates asking optionally anything that could be customised. Another important thing to me was, that it should be able to work with nib files as well as views created by code and Auto-layout.

See video: Not a very “designish” example of what can be done, but it shows all functionality. On the previous post you’ll see a much nicer version of it.


Please check it out at github, fork it, tweak it, comment it, would be nice to see it grow!
There is still work to do on it. Adding tests, more functionalities, etc.

In CocoaPods

And to finish just a note about CocoaPods and their great work, it was really ease to follow the steps with their awesome guides

I come across an issue as I have wanted to draw lines in a grid format. My first approach, drawing a UIBezierPath in a CAShapeLayer.

My issue is the resultant fuzziness on the lines, as they need to be located in floating values. Which makes actually sense that the lines are fuzzy. What I didn’t expect is that, if I use UIViews and position them on the exact same points as the Bezier points, I don’t get this fuzziness (see screenshot. UIView must be doing this correction somehow, don’t remember if in AS3 this was the case… but I am pretty sure even Views had to be on the integer value to avoid this.


I most likely will get the same result as the UIView, rounding up or down the floating values.

– Avoid Capturing JSValues -> mantain a strong reference -> Prefer passing as arguments

– Avoid Captuing JSContexts -> mantain a strong reference to the Global object -> Use +[JSContext currentContext] inside of the blog


– JavaScriptCore uses garbage collection -> All references in JS are strong -> It doesn’t matter if you create reference cycles as the GC can handle them

– Memory management is mostly automatic -> JSValue keeps things alive for you as long as you use JSValue

– But attention to:

-> String JS values in Objective-C objects as instance variables -> Use JSManagedValue for that, it is a garbage collected reference.

JSManagedValue by itself  is a weak reference to a JavaScript value.

addMangedReference:withOwner turns JSManagedVAlue into a “garbage collected” reference -> if JS can find the owner it keeps the reference alive otherwise it is released

-> Adding JS fields to Objective-C objects, fields that are added in JS but are not present on the JSExport object



JSVirtualMachin -> JSVM

– JSVM can contain multipe JSContexts

– you can have multiple JSVM with different multiple JSContexts

– JSValues can be passed between JSContext in the same JSVM

– but can not be passed between different JSVM -> each JSVM has its own heap and GC

– JavaScriptCore API is thread safe

– Locking granularity is at level of the VM, JS can be executed in different threads on the same VM but when one thread is executing JS no other thread can execute JS at the same time on the VM

– Use separate JSVM for concurrency


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


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 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!