Mostrando postagens com marcador mobile. Mostrar todas as postagens
Mostrando postagens com marcador mobile. Mostrar todas as postagens

sábado, 2 de agosto de 2014

[Quicktips] iOS - Follow Keyboard Animation Behaviour

On getting back to iOS programming I restarted to check into interesting subjects, like the right way of creating view controllers, behaviours and more.

One thing I had to create these last days was some code for a text field to follow the keyboard open/close animation. Then it come to me that we were going to use that behaviour was needed in more places and that it didn't belong to the view controller neither to the view using it.

So in order to achieve that I decided to create a behaviour class which features are:
  • To receive a target view
  • Register under keyboard events
  • Animate the target view to follow the keyboard open/close animation
  • Keep target view before (on top) of keyboard, meaning that target will be hidden when keyboard is closed
This set of features don't break the single responsibility principle since it is responsible only for controlling the animation behaviour of a view following the iOS keyboard.

To achieve our desire the class must subscribe to keyboard notifications and follow keyboard info dictionary in order to animate the same way the keyboard does.



In 1. we retrieve the type of animation, the duration and the final position of the keyboard. The problem with the animation type is that Apple uses a internal value which only works directly with the old animation style.
To use it with animationWithDuration methods we would have to shift the value, this isn't easy to understand and read later so is preferable to keep the old style in this case.

In 2. we use the animation calls on UIView to prepare animation with keyboard info.

In 3. we animate using the keyboard final position, in my case I'm positioning the view right above keyboard, and when dismissed the view will be hidden outside of the screen in the bottom. Also we have to commitAnimations so evertyhing will work properly.

That is all we need to create a behaviour that works with any view.

The class and the demo are available on github.



segunda-feira, 2 de maio de 2011

Quick Tip - IOS DEV - UIColor

This is a good fast tip for ios newbies (like me)....I was trying to use UIColor to create a color with RGB values like this:

But this natural approach is wrong and if you read Apple class reference here (as I did) you probably will realize that each color must be between 0 and 1....what a damn confusion uh Apple...

For those that didn't realize it before just divide it by 255 and everything goes well:

That's it folks!!!

quarta-feira, 10 de novembro de 2010

Ericsson Application Awards 2011

Que tal participar de um concurso mobile e ainda ter a chance de mostrar seu aplicativo para o mundo?
É isso que o Ericsson Application Awards 2011 da Sony Ericsson propõe. Junte entre 2 e 4 amigos, seus notebooks/pcs e suas IDE's e mãos à obra!!!!
Não se esqueça de seguir os critérios de avaliação o melhor que puder:
— Sua app deve ser baseada em 1 ou mais API's do Ericsson Labs.
— Inspire-se no tema “Connected Things”.
— Tenha um protótipo funcional de aplicação.
— A solução deve ser inovadora. (lembre-se nem sempre inovação deve ser criar algo que ninguém nunca viu antes)
— Tente manter um potencial comercial. (acho que esse é o mais díficil pois vai limitar algumas idéias)

 Não é mais um estudante? Não tem problema, tente convencer seu chefe a formar um ou mais grupos para participar da categoria para empresas (de até 100 funcionários), quem sabe não conquista mais do que o concurso?

E antes que você fale: "Ah mas não ganho nada?" aí vai a resposta, além da baita divulgação e espaço para fechar negócios você ainda pode ganhar 15000 euros.
 
Para maiores informações acesse os links:
Site Oficial: http://www.ericssonapplicationawards.com/
Overview: http://www.ericssonapplicationawards.com/overview
Regras: http://www.ericssonapplicationawards.com/rules

quarta-feira, 3 de setembro de 2008

Just Java 2008

Tech Ed, Search Masters, este mês de setembro está lotado de grandes eventos e temos mais um de 10 à 12 o Just Java, que acontece no Centro Universitário Senac, onde eu estudo ^-^!
Parece que a série de palestras será muito interessante este ano, mas teremos pouco assunto sobre mobile, no qual a linguagem Java é muito forte atualmente, infelizmente......
Aconselho o evento também, para quem puder pois infelizmente só não é mais caro que o Tech Ed.....
Visitem http://www.sucesusp.org.br/justjava2008/ para maiores informações.....
Não farei cobertura deste evento em sua totalidade, se fizer será sobre um ou dois assuntos, espero que gostem.