Apr
22

An HTML5/CSS3 Checklist; A wakeup call; A rambling

Here's a nicely designed support list for css3 and html5. Want to make an application with Canvas? Guess what, no IE users will be able to use it until IE9. So Flash does seem to be quite relevant to the consumer at this time: http://www.findmebyip.com/litmus

Then again, from what I've seen from the browsers that do have a wide array of support for HTML5 (namely, Webkit-based Safari and Chrome, Firefox), Flash as a platform is very much in trouble. The Flash IDE is still a great tool for design and content creation, but in my opinion Adobe is way behind the times with the CS5 release. Developing a game using the engine below would obviously be a lot more work than creating a game using an IDE, but you can see the potential if a company (maybe a certain fruit-based company, maybe Adobe finally releases a version of their software where all the feature additions aren't design-based?) were to make a new IDE that made it easy to create HTML/Canvas-based content: http://www.kesiev.com/akihabara/

Perhaps designers don't have much to worry about, but from a developer's perpective, this looks like something I want to learn ASAP to stay relevant. I love the Flash platform; I love Actionscript; and I'll continue to develop for and support the platform. However, it is impossible to deny forward progress and growth in technology, especially when said platform's creators aren't moving at the speed that the market demands. AIR2 and Android look like a match-made-in-heaven, but they should be available now, not as a coming-soon afterthought after the big iPhone packager push failed. I just worry that Adobe won't be able to catch up.

Anyway, the market isn't demanding Flash; they are demanding devices. I will write code with Objective-C for iPhones and Actionscript for Android. I've made my peace with Apple's Terms and Conditions. It is what it is; a business decision. I refuse to allow personal ideology to effect my options for career development. Apple'll take my money when I want to make money with their system and Adobe'll take my money when I am locked-in to developing with their tools (please don't tell me to get Gimp instead of Photoshop ;)). It's all the same to this guy.

Apr
17

Objective-C: Properties and Instance Vars Gotcha

Learned an important lesson today regarding properties and instance variables (ivars) in Objective-C today. For example, consider the following interface and implementation:

@interface MyButton : UIButton
{
    NSString *label;
}

@property (nonatomic, copy) NSString *label;

@end

@implementation MyButton

@synthesize label;

@end

Now, inside my button class if I reference label:

label = @"Click Me!";

This directly accesses the ivar (NSString *label) and not the @property. To access the property, you would use self:

self.label = @"Click Me!";

The important thing to note here is that if you access the ivar directly, you are bypassing the getters/setters created by the synthesized property. I was having issues where variables I created were not being retained, and adding "self." solved it, leading me to this realization that I wasn't actually accessing the property. My new style for reminding me when I'm accessing an ivar or property is my old tried-and-true method for differentiating private vars in Actionscript or PHP; the underscore:

@interface MyButton : UIButton
{
    NSString *_label;
}

@property (nonatomic, copy) NSString *label;

@end

@implementation MyButton

@synthesize label=_label;

@end

Check the difference above. I changed the synthesize statement to point to a differently named instance var. So when I access "self.label," it will modify _label through the getter/setter. You can also use _label inside the instance to directly access the ivar.

Apr
04

Flickring UIButton State Issue

Ran into a very specific "bug" in my iPhone application today. We have on our about page of the application two images for the highlighted and normal states of a button. It works as expected when you "press" and then "touch up" at a slow pace, but if you click/tap it quickly, there's a noticeable flicker between states. Here's the code inside the subclass of UIButton that creates the buttons:

UIImage *normalImage = [[UIImage imageNamed:@"btn-small.png"] stretchableImageWithLeftCapWidth:10.0f topCapHeight:0.0f];
UIImage *highlightedImage = [[UIImage imageNamed:@"btn-small-down.png"] stretchableImageWithLeftCapWidth:10.0f topCapHeight:0.0f];

[self setBackgroundImage:normalImage forState:UIControlStateNormal];
[self setBackgroundImage:highlightedImage forState:UIControlStateDisabled];
[self setBackgroundImage:highlightedImage forState:UIControlStateHighlighted];

[self setAdjustsImageWhenDisabled:FALSE];
[self setAdjustsImageWhenHighlighted:FALSE];

When a button is tapped it simply disables itself and enables the other button:

- (IBAction)aboutButtonTouched:(id)sender
{
    aboutButton.enabled = FALSE;
    rulesButton.enabled = TRUE;
}

- (IBAction)rulesButtonTouched:(id)sender
{
    rulesButton.enabled = FALSE;
    aboutButton.enabled = TRUE;
}

This works fine, but there's a noticable "flicker" when tapping the button quickly (and not a delicate press, hold, and release). The solution to this flickering took a bit of reverse engineering. The first thing I did was modify the aboutButtonTouched method to log the button's state property which is a bit-mask NSUInteger:

- (IBAction)aboutButtonTouched:(id)sender
{
    rulesButton.enabled = TRUE;
    aboutButton.enabled = FALSE;    
    
    NSLog(@"%d", [sender state]);
}

At this point, the button is disabled through setEnabled, and the log reported that the state was "3". Looking at the bit-mask type for UIControlState (Comments added since I can never remember bitwise):

enum {
   UIControlStateNormal               = 0,            // 0
   UIControlStateHighlighted          = 1 << 0,       // 1
   UIControlStateDisabled             = 1 << 1,       // 2
   UIControlStateSelected             = 1 << 2,       // 4
   UIControlStateApplication          = 0x00FF0000,
   UIControlStateReserved             = 0xFF000000
};

We can see that to get "3" (0011) we should use UIControlStateHighlighted | UIControlStateDisabled (0001|0010 or 1|2), something which I did not have as a state in my original button definition. The key here that there's a brief time when the state is both before only being disabled ("A control enters this state when a touch enters and exits during tracking and and when there is a touch up" -- from the docs). So the final state settings for the button where it does not flicker are:

[self setBackgroundImage:normalImage forState:UIControlStateNormal];
[self setBackgroundImage:highlightedImage forState:UIControlStateDisabled];
[self setBackgroundImage:highlightedImage forState:UIControlStateHighlighted];
[self setBackgroundImage:highlightedImage forState:UIControlStateHighlighted|UIControlStateDisabled];
Mar
23

Hacynth: Spring Sessions Mix

Download Spring Sessions Mix

Listen To Your Heart - Soul Mosaics
Hidden Memories feat. Lilw - Human Factor, T-muniz
Nice Dude With Ice Cream - Kasper
Grapefruit - Donnie Dubson
Up The Mountain - Bomb The Bass, Markey, S.P.Y.
London Express - BrokenDrum
Vice - DatA
Give Me Your Love - Spy, Random Movement, Marky, Miri
Togetherness - Marky, Makoto
Brothers - Redeyes
Good Inside - Jazz Thieves
Paradise - Edward Oberon
Battlecat - Donnie Dubson
Infrasonic - Ulterior Motive, Judda
P-Style - Squash
It Was The Future - Dakosa
Oceans Above Life - Deep Life, ASC
Style Is A Cage - Marginal
Scotch Bonnet - Random Movement
Back In Time - Stunna

prev 1 2 3 4 5 next

Products

Goodies

T1EOS

Content Management System T1EOS: Content Management System

Our customized content management framework T1EOS manages articles, blogs, categories, events, tagging, images & galleries, a Facebook Connect integrated commenting system, and more — all out-of-the-box.

github

ASRA

A Simple Restful API

ASRA is a lightweight package that assists in the rapid development of simple APIs for exporting data for Flash, Flex or other applications.

Download

Plum Dumb

A Typeoneerror TextMate Theme Plum Dumb