Objective-C Method signature

February 2, 2010 by russellf9

Notes on Objective-C Method Signatures

I’m still not finding the Cocoa Touch language ‘natural’ so I decided to make a few notes and make sone examples to cement my understating.

Examples:

- (id)initWithInt:(int)value;

defines a method initWithInt that returns a general object (an id) and takes one integer argument. Objective-C only requires a type in a signature to be explicit when the type is not id; this signature is equivalent:

- initWithInt:(int)value;

(see Wikipedia method signature)

———————–

Class Methods are declared by +

Instance Methods are declared by a preceding –

(see p.36 Introduction to The Objective-C 2.0 Programming Language )

Importing Illustrator Files to Flash

January 27, 2010 by russellf9

Copying images from Adobe Illustrator to Adobe Flash, which require a Gradient

Introduction

As I generally stick to the code side of Flash, I’m a bit rusty when it comes to the design and Timeline stuff. I needed to import Illustrator content to a Flash Movie, I assumed ‘copy and paste’ would be OK and I would be left with neat low memory Vectors. Unfortunately a whole load of Bitmap Meshes appeared in my Flash library, rather than just a collection of shapes in the timeline.

Explanation

Nothing I could do in Flash Preferences ‘AI File Importer’ helped, so I had to find the solution with Illustrator. The ‘Mesh Objects’ are used for gradient and 3D effects and can be converted to Paths, see: Extract Paths From Mesh Shapes.

Solution

Make the Path from the Mesh as above, remove the Mesh layer, (I also made a Path layer invisible). Then copy and paste. The Path for the Gradient vector is imported into Flash, but unfortunately the Gradient has to be remade! Again I’m rusty with gradients, the new gradient has to defined in the Color Mixer, select: Window – Color, then applied to the new shape. See Flash CS3 : finding the gradient transform tool and Working With Gradients in Flash CS3 for more Gradient help. With quite a bit of fiddly work the look of the Illustrator file was reproduced approximately.

Conclusion

This all seemed a bit too much work, converting one Adobe format to another, I think keeping Flash assets 100% vector is a reasonable request! Perhaps there is an easier solution out there, or perhaps it would be best to insist on source files being Flash Vector Compatible in the first place!

Further Notes

  • Remember to set the Document Color Mode to RGB in Illustrator, otherwise the color will not be accurate in Flash

Objective-C Confusion

December 23, 2009 by russellf9

Introduction

As mentioned in a previous post I’m getting to grips with the idiosyncrasies  of Cocoa Touch, i’ll try and document them here.

Confusing Errors

Sometimes the errors listed are not exactly helpfull, see Confusing Objective-C Warnings and Errors.

iPhone 3.0 SDK Development has a very helpfull chapter dealing with confusing error issues.

AS3 to Cocoa touch

December 23, 2009 by russellf9

Introduction

As a Flash AS3 Developer who has started developing for the iPhone, I’m very interested in finding information from developers who are on a similar learning curve. I’m confident in using MVC, specifically the PureMVC framework.

There are significant similaraties and difrences in AS3 and iPhone Developemnt.

AS3 and Cocoa touch

Cocoa touch relies on an MVC framework, the iPhone SDK uses a ‘wizard’ similar to Flexbuilder, the syntax of Objective-C is somewhat diffrent to AS3 dot syntax, Objective-C uses Dynamic Typing and means (some) errors can only be checked on runtime, whilst AS3 can Static Typing, which means errors can only be checked on compile time.

Flash to Cocoa touch blogs

Other developers who have gone through a simialr process and have blogged their findings. Anton Mills has some interesting posts, and Nick Kuh too.

Nick has a great video clip…on the differences between OOP programming languages such as ActionScript 3 and Objective-C

Donald Bellenger lists some handy ‘migration points‘ on his post AS3 to Objective-C Cocoa Touch. There are some good points on TypeCasting and Static Methods.

iPhone Sales Figures

December 11, 2009 by russellf9

As I’m interested in creating my own iPhone app, I’ve researching which type of app sells and which app of each genre is a good seller.

Sales figures do not appear in the iTunes App store but the number of reviews do. There’s a method to questimate the number of sales from the number of reviews. See Guess sales figures. This method suggests a review to sales ratio of 350:1, that is 1 review would equal 350 sales.

The responses to  Peter Melnikov’s post seem to agree to the ratio with some reservations and exceptions, so until a better method is found I’ll use his!

I’ve stumbled across a site apptism which tracks iPhone apps, it does not include sale figures, but amongst other things the site lists the top apps.

ProgrammingBooks

December 11, 2009 by russellf9

Programming Books

iPhone SDK

I’ve just aquired iPhone 3.0 SDK Development, and thought I should put a good list of iPhone SDK books on my blog.

Javascript within Eclipse

December 3, 2009 by russellf9

Introduction

I’m very interesting in rationalizing the number of tools and packages used to writing code. Eclipse is my favoured IDE, and for some time I’ve been interested in finding a decent plugin to make writing Javascript, HTML and XML easier within Eclipse, rather than using Dreamweaver or UltraEdit.

Plugins

I’ve found RockStar Optimizer and am currently testing it to see if it’s fit for purpose.

The plugin can be downloaded via Eclipse, the instructions can be found here: Installation Instructions

Instructions for using the for Javascript part of the Optimizer can be found here: JsLint Eclipse Plugin.

Interestingly the Validator was developed by Douglas Crockford the author of JavaScript: The Good Parts.

It seems the JsLint Plugin is a Validator, rather than a IDE extension like FDT.

I’m also looking at JSEditor, which maybe a little old for my Eclipse, but it promises syntax highlighting and OO approaches.

WTP

The Eclipse Web Tools Platform (WTP) has made JSEditor redundant, installation instructions can be found here.

(Although I’m having trouble adding a new repository with Eclipse, and my have to resort to downloading the zips.)  Also, there a lot of Required Prerequisites so it’s taking bit of time to do!

I downloaded the following zips which are ‘prerequisites’ :

  • emf-runtime…
  • xsd-runtime-2…
  • GEF-SDK…
  • dtp-sdk_…
  • And the non-SDK package wtp.

I then copied the files from the unzipped files to the ‘plugin’ or ‘features’ folder of my version of Eclipse.

I restarted Eclipse (After updating to 3.5.1), and opened a new view – Web, and viola my Eclipse is now capable of creating HTML pages with various assistants.

Conclusion

I’ll give WTP a good test as it seems to have a lot going for it! I’ll check out javascript and HTML validation later and create a specific WTP post if the Plugin is effective.

I’m currently having trouble updating my Eclipse at work to 3.5.1, found a possible solution at: Eclipse Update Problems: No Repository.

Issues with certain Unicode Characters

December 2, 2009 by russellf9

Working on a French Flash activity, I had problems displaying certain French characters:

    OE Upper Case ligature  Unicode 0152
    oe Lower Case ligature Unicode  0153
    Ÿ  Upper Case diaeresis Unicode  0178

With a normal (8-bit) font these characters cannot be displayed, so I created a Method in a Class StringUtilities to replace these characters with alternatives.


 —
 public static function replaceFrenchLigatureCharacters(text : String) : String {
            var len : Number = text.length;
            var returnText : String = “”;
             for (var i : Number = 0;i < len; i++) {
                var char : String = text.charAt(i);
                var code : Number = text.charCodeAt(i);
                switch(code) {   
                    case O_E_SMALL_LIGATURE  :
                        returnText += “oe”;
                        break;
                   
                    case O_E_UPPER_LIGATURE :
                        returnText += “OE”    ;
                        break;
                       
                    case Y_UPPER_DIAERESIS :
                        returnText += “Y”;
                        break;
                    default :
                        returnText += char;
                }
            }
            return returnText;

        }
 —
 —

This is going to be an issue for all non standard characters which belong to the Extended-A_Unicode_block rather than the standard Basic Latin (00 to 7F) and the Latin-1 Supplement (80 to FF) . So I’m sure this issue will raise it’s head again.

Fave iPhone apps

October 10, 2009 by russellf9

The following, is a list of my favourite iPhone apps

In each item I’ve provided a link to the iTunes store, and link to the Apps maker.

Educational and Children’s:

Language Learning:

Further Lists:

I’ve come accross another iPhone app list which is worth linking to: 50 Helpful iPhone Apps for Web Designers and Developers.

Resources for iPhone Development

October 10, 2009 by russellf9

Online resources for iPhone Development

Iv’e been fully enrolled in the iPhone Developer Program, which means I can upload apps to my iPod touch and access the Apple developer site for resources.

The intention of this page is to provide quick links to resources I find useful.