was successfully added to your cart.
All Posts By

cobiinteract

Mii: Laura

By | Fun, Mario Kart | No Comments

Name: Laura Kritzinger
Nickname: Leia
Likes: Gadgets…kitchen gadgets..
Dislikes: Steve’s MK noises
Speciality (what we go to Laura for): All the little things that make Cobi run smoothly
MK signature move: Feeds us real life power ups to create more energetic MK games

Quick and Easy iPhone Gradients

By | development, iPad, iPhone, Mobile Development

The market for iPhone and iPad apps is competitive and sometimes a bit of extra eye-candy goes a long way. For a couple of projects I have had to give various items a gradient shaded background. There are two ways to do this. Core Graphics or Core Animation. Gradients in Core Graphics give you more customization and more control, but are more complex to implement, while gradients in Core Animation are simple, but may not be able to do everything you need. Here we are going to look are the fast Core Animation approach.

Make sure you #import <QuartzCore/QuartzCore.h>

To make a simple rectangular gradient all we need is to add a CAGradientLayer:

CAGradientLayer * gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = CGRectMake(0, 0, 80, 60);
gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor redColor] CGColor],(id)[[UIColor greenColor] CGColor], nil];
[self.window.layer addSublayer:gradientLayer];

This produces a rectangle that can be used in any view:

We can give the layer rounded corners by adding:

gradientLayer.cornerRadius = 10;

For more complex shapes we can set a mask for the gradient layer using a CAShapeLayer:
//Make shape – Triangle
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL,40.0f, 0.0f);
CGPathAddLineToPoint (path, NULL,80.0f, 60.0f);
CGPathAddLineToPoint (path, NULL,0.0f, 60.0f);
CGPathCloseSubpath(path);

//Shape layer
CAShapeLayer * mask = [CAShapeLayer layer];
mask.path = path;
[gradientLayer setMask:mask];

//release path
CGPathRelease(path);

UIButton with a gradient:

 

The graph I made for a project using Core Animation layers:

Cobi is 2!!

By | Announcement | No Comments


We’ve made the 2 year mark and still going strong. A lot has happened in the past year. We’ve grown from a team of 3 to a team of 7, we a have a real office, some exciting projects and a lot more exciting mario kart sessions. Thanks to the Cobi team for all the hard work.

Latest releases- PimPamPet & BusinessDay apps

By | Cobi News, iPad, Releases

As always, the Cobi developers have been busy over the past few months.

The latest releases span from an interactive game to a news app.
PimPamPet is a well-known question-and answer game from Jumbo Games, a Dutch founded jigsaw puzzle and games company. The project was commissioned and managed by Amsterdam based mobile agency, FONKMobile, who met with us in Cape Town earlier this year.

The game needs to be played in 2 teams, and the iPad and iPhone apps make use of the touch gesture to spin the wheel, complete with realistic sound effects. Regular outbursts of “Pim!Pam!Pet!” accompanied the development of these apps and now that they’re completed the office is feeling rather quiet!

The iPad app developed for BusinessDay has been long in the pipeline and seems to have been well received. Marc Forrest of MarcForrest.com reviewed the app and said “If you own an iPad I highly suggest you get this app. By far one of THE best daily’s I have seen on the iPad.”

BusinessDay is South Africa’s most influential and respected business news and analysis source, offering incisive coverage of business, politics, labour and other current affairs, written by the country’s award winning journalists.

To get the PimPamPet app, click here.

To get the BusinessDay app, click here.

Objective-C: Blurry UIView

By | development, iPad, iPhone, Mobile Development | No Comments

If you’ve been coding Objective-C interfaces for a while you will know that you set the position of a view using it’s frame property. This property is a CGRect which is made up of four float values.  newView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0);

At first these floats were quite an annoyance because when debugging using NSLog() to check if frames were set correctly you have to use NSLog(@"%f",newView.frame.origin.x); and this is printed as a decimal number i.e. 0.00000

After getting used to this and starting a project that required 3 columns down the screen I thought that I could finally use the floats to their full effect. So I divided the space neatly by three and drew UILabels. UILabel *firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 1024/3, 768.0)];

Unfortunately this caused my UILabels to become fuzzy or blurry. After an extensive google search I found out that you should NOT be setting your frames using float values. Although CGRects take float values, when a UIView gets drawn and it has a decimal value in the frame it will blur that value to the nearest integer. This makes sense when you remember that the value you are giving is meant to represent a pixel value and a view cannot end halfway through a pixel.

So you should ensure that your frame does not contain any decimal values. An easy way to do this is to use the roundf() function. If placed around all 4 values in your frame you will always have an integer value, however this is a lot of extra code and you only have to do it where there is a possibility of having a decimal value. So my above label example became
UILabel *firstLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, roundf(1024/3), 768.0)];

Using a view’s center property it is possible to get a point with a .5 value (any view with a width or height that is odd will give you a .5 value). Using a view’s center to position another view should therefore be done using roundf(). For example say you have a white view and you want to cover it from the middle to the bottom right corner with red:

UIView *bigView = [[UIView alloc] initWithFrame:CGRectMake(30.0, 30.0, 67.0, 71.0)];
bigView.backgroundColor = [UIColor whiteColor];
[self addSubview:bigView];

UIView *smallView = [[UIView alloc] initWithFrame:CGRectMake(
                                roundf(bigView.center.x),
                                roundf(bigView.center.y),
                                roundf(bigView.frame.size.width/2),
                                roundf(bigView.frame.size.height/2)
                                                                                                )];
smallView.backgroundColor = [UIColor redColor];
[self addSubview:smallView];

[bigView release];
[smallView release];

Deploying a BlackBerry app for OTA installation

By | BlackBerry, development | No Comments

When testing a build of a BlackBerry app, one method to deploy the app on a BlackBerry OTA is to host all of the application COD files and a main JAD file with the relevant details of each COD file in it. Once hosted, one can point the BlackBerry device to the JAD file being hosted and the application COD files will be installed on the device.

While this isn’t such a problem with single projects in isolation, anyone who has had to do this manually where multiple projects (such as library projects) are involved in the deployment of a single app, will known that the process of assembling the COD details into a single JAD file is rather menial and in general quite insufferable. Fortunately, the BlackBerry JDE comes with a tool called updatejad.exe and works as follows:

Let’s use a main project name of Peanut and peanut relies on the library projects Raisin and Salt. To assemble the Peanut.jad file with the COD details of all the projects, one can use the following command:

updatejad.exe Peanut.jad Raisin.jad Salt.jad

I find it easiest just to copy the necessary JAD and COD files to a single directory when running this command. There you go… you now have a deployable JAD file to host along with all of the application COD file 🙂

Mii:Stephen

By | Fun, Mario Kart | No Comments

And for our next Mii..

Name: Stephen Asherson
Nickname: Jobs
Likes: Coffee and bananas
Dislikes: Nokia and Symbian
Speciality (what we go to Steve for): Network security and technical info.
MK signature move: First item is always a giant mushroom and goes on a rampage.

Mii:Steve

By | Mario Kart | No Comments

So if you’ve read my previous blog posts, you would know that we have a wall of Mii’s in our office. First Mii on the wall is Steve.

Name: Steve Preston
Nickname: Ballmer
Likes: Chicken burgers
Dislikes: Curry smells
Speciality (what we go to Steve for): CSS help
MK signature move: Attain 3 red shells, wait for opponent to pass, shoot, wait for opponent to recover, shoot again, and again.