Friday, February 8, 2013

Using -webkit-tap-highlight-color

In earlier versions of mobile safari  if you used -webkit-tap-highlight-color on a link, you'd also have to specify the active color.  That would give you a nice contrast.  However, since about iOS 5 that no longer works - both the foreground and background are set to the highlight color.

To be able to see the text now, it seems that you need a transparent color.  This works:

-webkit-tap-highlight-color:rgba(26,26,26,.5);


Wednesday, February 6, 2013

Wrapping text around an image AND stopping the wrap.


I like being able to use HTML to wrap text around images.  It looks professional and it's a simple way to inject some cool in an HTML page.

However, sometimes the image is bigger than the text, and at that point you may want to start a new paragraph that is beyond the image.  I was never able to find out how until today:  Just needs

<BR CLEAR="left"> 


See? Down here now! Note that "left" can be other values (e.g., "right","all") to configure appropriately.

Friday, February 1, 2013

Using Google TTS (text to speech)

I was doing some investigation on Text-To-Speech (TTS) for iOS and found a little snippet of code that could be added to any app for some quick TTS.

The catch is that it's limited to just 100 characters and you never know when Google might pull the plug on it, but still, it's pretty cool.


#import <AVFoundation/AVFoundation.h>

...

    NSString *linkTTS = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?tl=en&q=%@",@"this+is+really+quite+cool"];
   
    NSData *dataTTS = [NSData dataWithContentsOfURL:[NSURL URLWithString:linkTTS]];
   
    AVAudioPlayer *_googlePlayer = [[AVAudioPlayer alloc] initWithData:dataTTS error:nil];
    [_googlePlayer play];