dimarts, d’agost 28, 2012

Property lists and push vs. modal segues

This is the first post about findings on developing an application for iOS. I've just finished  (well, almost) the Coding Together course for CS193P. The course itself ended yesterday. I'm developing a real application to be submitted to Apple in the near future but I have not presented it inside the course as the timing did not suit me.
Developing the first version of the application I discovered this:

  • property lists need to have strings as keys, otherwise when you write them to file or URL the method will return NO. This can be inferred from the fact that the property list editor in Xcode has no UI for setting the type of the keys, only for the type of the values.
  • Xcode allows you to choose Push as type of a segue even if you are not inside a Navigation Controller, although the Push type in fact makes sense only when you are inside a Navigation Controller. The initial version of my app just had a Tab Bar Controller, there will be a Navigation Controller but there is not any right now. So I had to choose Modal as segue type, since choosing Push results in the segue not being performed when you click on the button that should perform it, no exception or warning appears.

dissabte, d’agost 25, 2012

Showing static content in a iPhone/iPad app

I'm writing an application which shows some static text in one of its parts. The text is descriptive and quite long and with format, with different sections, emphasized stuff, underlined stuff, and so on, so a UIWebView is best suited for this (a UITextView applies its formatting to the whole of the text it shows).
Initially I thought I would be taking advantage of the fact that UIWebView can also show Word files or PDFs. But neither was usable, for some reason or other the PDF could not be pinched for zooming and was too small to be read. The Word could be pinched but panning to the right to read each line is not that usable.
I decided therefore to use HTML for the web view and found the plentiful information about HTML for iOS Safari available in the Apple documentation. Though the doc just doesn't suggest any application to create that HTML.  HTML has been around for so long... yet a suggestion would have been useful.
First I looked at iWeb, which is a cool program to create a website but not really suited for what I needed. Besides, it has been discontinued.
After googling around, I settled for Komodo Edit, which is free and is quite lightweight yet helpful. But my HTML had accented characters and it does not support them out of the box so I had to replace all "é" with "ampersand e acute" and the same for all other accented characters, which is not cool.
At least now the text flows nicely and is scrollable.

divendres, d’agost 10, 2012

El nom del MNAC

Ara surt el director del MNAC, Josep Serra, nebot del gran polític i economista Narcís Serra, i diu que el MNAC hauria de portar Barcelona al seu nom. No he sentit les declaracions del nebodíssim però la xarxa bull i amb això ja està tot dit.
El seu oncle va sortir fa poc a les notícies ja que tenia una poltrona daurada a CatalunyaCaixa (que tot i tenir tan il.lustre director igualment es va enfonsar en la cosa marró).
Un polític que semblava d'Iniciativa li feia preguntes al Congrés sobre CatalunyaCaixa (era una comissió d'aquestes...). Després va intervenir el de Convergència o Unió i va dir que ells no li'n volien fer cap perquè era directiu no executiu de l'entitat. O sigui el Sr. Serra cobrava un salari indecent i no participava en cap presa de decisió ni era responsable de res. A sobre li vam pagar el viatge a Madrid i les dietes corresponents suposo.
Avui es manifestaven uns a Barcelona amb una samarreta negra que deia alguna cosa com "Menys retallades, retalleu la corrupció". Quanta raó que tenen, només faltava dir-hi "incloent-hi el nepotisme, és clar".