Posts Tagged ‘ipad’

Code for multitouch

Posted in code on June 30th, 2011 by admin – Be the first to comment

In my latest app Loopy Tunes, I needed to add multitouch functionality to a keyboard. I use Cocos2D, so if you’re like me, then just do the following.

In your delegate.m class, add this line

[glView setMultipleTouchEnabled:YES];

right after this one.

[director setOpenGLView:glView];

Then in your class.m where you are testing for multitouch, up in your init method, add the following line

self.isTouchEnabled = YES;

And then add your touch method somewhere down under the init method, just update the values of the areaToCheck

- (void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{      
    NSSet *allTouches = [event allTouches];
    for (UITouch* touch in allTouches) {
       
        CGPoint location = [touch locationInView:[touch view]];
        location = [[CCDirector sharedDirector] convertToGL:location];
       
        CGRect areaToCheck = CGRectMake(100,100,100,100);
        if(CGRectContainsPoint(areaToCheck, location)) {
            // whatever you want to happen here
        }
    }
}

Icons required for a universal app

Posted in code on June 30th, 2011 by admin – Be the first to comment

When preparing my universal app for iTunes I was having trouble with getting the icon.png file the right size. When I saved a 57×57 pixel icon iTunes complained about needing a 72×72 pixel icon for the iPad an vice versa for the iPhone. So I googled and found there are a couple of things you need to do.

STEP 1

Create all the icons listed in here under Table 3: Universal apps icon requirements. Then add them to your project in xcode. (you know, drag em into your resources folder)

http://developer.apple.com/library/ios/#qa/qa1686/_index.html

STEP 2

On that same page down the bottom are the instructions for how to enter these to your info.plist. Follow them, or just add this to your info.plist if it isn’t in there already.  (I prefer to edit the info.plist myself in textEdit) If you are using a cocos project, especially 0.99.5 or newer, it should already be in there.

<key>Icon files</key>
<array>
     <string>Icon.png</string>
     <string>Icon@2x.png</string>
     <string>Icon-72.png</string>
     <string>Icon-Small-50.png</string>
     <string>Icon-Small.png</string>
     <string>Icon-Small@2x.png</string>
</array>

STEP 3

If you have the following in your info.plist,

<key>CFBundleIconFile</key>
<string></string>

replace it with

<key>CFBundleIconFiles</key>
<array>
     <string>Icon.png</string>
     <string>Icon-72.png</string>
</array>

Fonts supported by iPad

Posted in Uncategorized on January 28th, 2011 by lucy – Be the first to comment

I had to look this up, so here it is for future reference

American Typewriter, AppleGothic, Arial, Baskerville, Bodoni 72, Bradley Hand, Chalkduster, Cochin, Copperplate, Courier, Courier New Didot, Futura, Geeza Pro, Georgia, Gill Sans, Heiti J, Helvetica, Hoefler Text, Marker Felt, Optima, Palatino, Papyrus, Party LET, Snell Roundhand, Thonburi, Times New Roman, Trebuchet MS, Verdana, Zapf Dingbats, Zapfino.