Archive for 'Programming'

Snippet: 306 Colors

So there was this thread on iPhoneSDK where a fellow was wondering what UIColor to use to imitate Settings.app’s non-editable text — R81, G102, B145 was the suggestion — and along with that came a post of 305 other colors, from alizarin through zinnwaldite. Which is already more new words than we learn in an average day. So we figured we just had to grab that!

We’d repost it but it’s a bit long and annoying to reformat from text, as we know having just done exactly that … so if you want to find out what UIColors “caputMortuum”, “razzmatazz”, “tyrianPurple” and another 300+ are, download TWUIColors.zip and check for yourself!

UPDATES:

And there’s another UIColor helper set in Erica Sadun’s github collection!

UIColor Helper Library Providing 100 Predefined Colors And Easy Color Scheme Creation

Library Providing A UIColor Category For Easy Access To iOS 7 Colors

Handy Library Providing Easy Access To Colors And Gradients Used In iOS 7 Apps And Icons

Handy UIColor Categories Providing Easy Access To Crayola And Pantone Colors

Open Source UIColor Add-On Library Providing Easy Access To Colors Used By Specific Brands

Open Source iOS Library Providing Helpers For Flat UI Colors

bfeher/BFPaperColors: “Flat colors taken from Google’s Paper Material Design.”

Continue Reading →
0

Code: llamasettings

So, been thinking about implementing your app’s settings internally, perhaps with the code we mentioned before? Well, here’s another fine-looking option, llamasettings at Google Code:

llamasettings is a series of classes to be used in your iPhone SDK application that provide a standard-looking settings list.

There are some screenshots that you can look at of it in action.

Advantages over Settings.app

  • Pre-canned, working code – You don’t need to fidget with creating tables, figuring out default settings, etc.
  • Standard PLIST file format – based heavily on Apple’s settings schema, so it’s already something you know.
  • Integrated within your application – the user doesn’t need to exit the app to change a setting
  • More extendable – all of the source is available, with an easy interface to add more widget types
  • More configurability out of the box – provides things like date pickers, color pickers, and so on, not available in Apple’s Settings.app

h/t: iPhoneSDK!

Continue Reading →
1

Tip: Multiple keychains

As you’re quite undoubtedly aware if you work for more than one client, the process of switching signing identities to select the correct provisioning profile is … non-optimal, shall we say? Our current “solution” actually involves manually deleting all except the currently in use certificate from the login keychain so Xcode doesn’t descend into hopelessly gibbering confusion by actually having more than one distribution option available. And Ad Hoc … well, we just don’t even try that on our development machine anymore.

But ho! Here’s some instructions from an obviously very clever fellow who’s sorted out how to set up individual client keychains with the appropriate certs and keys for each portal you’re involved with. The main trick it seems for getting from what ought to work to what actually works without having to completely wipe your phone and restart while flailing at it is knowing that the only tool that apparently is any good is managing this stuff is iPhone Configuration Utility from Apple, so you should use it for all your profile work, and just make iTunes and Xcode shut up and stay out of the way while the grownups sort things out!

[EDIT: But watch out for some versioning issues with the device communication frameworks; if you've installed a 3.0 beta SDK and then install iPCU, you'll have to reinstall the beta SDK -- not the 2.2.1 release! -- before iTunes/Xcode will see your devices again. Whoops!]

[EDIT: And here is a useful wiki for your clients which includes instructions for the team agent to create and mail you the distribution profile and certificate. A useful place to point them at, indeed!]

[EDIT: And here's a tip for a script to add to set the keychain to what you want for a project:

#!/bin/sh
/usr/bin/osascript - <<***
tell application "Keychain Scripting"
set current keychain to keychain named "mike.keychain"
end tell
***

Yes, never forget that AppleScript is usable from the command line!]

Continue Reading →
0

Code: zip

Feel like using .zip compressed files in your iPhone program? Here’s a couple wrappers for Minizip to make that process easy!

For super simple needs, there’s nuzip on github:

NuZip currently has a trivially simple interface, methods called “zip:” and “unzip:” that take a single argument, a string that would correspond to the command-line arguments given to the minizip and miniunz tools…

And if you need a little more, there’s ZipArchive found on Google Code:

… it’s easy to use, you can declare a instance and call initialize functions, and then call addFileToZip or UnzipFileTo to finish compression or uncompression…

Also note some good advice in this thread about dealing with NSData objects and .gz files.

UPDATES:

Open Source Libraries And Examples For Zip, Rar, and 7-Zip Compression

Open Source Easy To Use iOS Zip Compress Library

mattt / Godzippa: “GZip Compression / Decompression Category for NSData”.

Objective-C Library Providing A Clean Syntax For Unarchiving Zip, Rar, And 7zip Files

Open Source iOS Library Providing Direct Access To Data Stored Within Zip Files

Continue Reading →
0

Resources: cocos2d

So there seems to have developed a general consensus in the iPhone development community that if you’re planning to develop a sprite-based game, the cocos2d-iphone framework that we mentioned waaaaaay back when and a bit later on is the way to go. So since we’re planning on doing exactly that, here’s a roundup of resources for your cocos2d development!

Project and wiki on Google Code, for starters.

cocos2d-iphone.org is the official center for all things cocos2d.

Sapus Media is the creator’s home page with links to cocos2d related stuff as well. Note blog.

cocos2d for iPhone API reference is there as well. Also note wiki. And how to install in Xcode.

Sapus Tongue source and optional support is available at varying prices, and we strongly recommend you support the author by purchasing it — hey, we did!

cocos2d-iphone-discuss is the nice and active discussion list. Note the community pages there as well.

[UPDATE: Due to massive Google suckage, the community is now a bbPress forum!]

cocos2d.org is the original Linux/Mac/Windows library using Python instead of Objective-C, where more useful documentation can be found.

cocos Live is a Google App Engine-hosted service for high score submissions.

cocoslive-discuss is the companion list for cocos Live.

[UPDATE: Now it's part of the above bbPress forum too!]

And more good stuff found around the web includes

Whitepaper: Introduction to Cocos2d iPhone from the experiences of the authors creating touchDefense with it.

Also see the cocos2d tag on one of the touchDefense authors’ blog … and on the other one’s too. Particuarly this post and source project about sprite colouring.

Here is a tutorial series covering setup through collisions and particle systems; also check out others with the cocos2d tag on that blog.

Cocos2d: Bouncing Ball Example is a walkthrough of creating a scripted animation.

Cocos2d Example – Bouncing Ball is, oddly enough, completely different than the last one, a walkthrough of creating non-scripted animation!

Scripting cocos2d-iPhone actions with XML is for your really hard-core scripting needs.

This fellow has open sourced his ABC123 game and a tile based game shell with accompanying tile map editor; see lots of good blog posts as well. Not to mention a cocos Live WordPress plugin, of all things.

Gorillas is another open sourced cocos2d game.

In case you missed it in the discussion links above, more sample games and miscellaneous files can be found at cocos2d-iphone-discuss.

Texture Atlas Creator is a nifty web application for, well, creating texture atlases, eponymously enough.

Speaking of which, Using Cocos2D AtlasSpriteManager has useful advice on using them.

Making Seamless Repeating Backgrounds is a helpful tutorial.

The SilentMac Design blog has some good cocos-tagged entries too.

Cocos2d Iphone Dynamically Touch Detection has some advice on implementing touchable sprites.

An introduction to game physics with Chipmunk gives you an excellent tutorial on the physics engine that comes with cocos2d.

If you like videos, here’s a Hello World app creation walkthrough.

And there’s various project templates in the above links, but here’s another and yet another on github. And even yet another on Google Code. And yet^4 another … and yet^5 another … they’re just everywhere!

… and finally, here is a bit of amusement for you. Remember when we posted that 3D engine roundup, and said “we’re definitely going to follow his experiences with the engines of choice!” Well, here’s your followup: he ended up using cocos2d with the Box2d engine port!

Over Easter I decided to drop a dimension in my iPhone project to go from a 3D evolution game simulator to 2D… It was obvious that cocos2d had already solved the problem of a simple game engine, and then some.

I was decided. The rapid progress I was able to affect in 2D with both chipmunk and box2d as well as the ready-to-exploit and well documented cocos2d game engine convinced me…

Well, with an endorsement like that, we know we’re on the right track here, yes?

[UPDATES:

BIT-101 Blog has some useful posts on curves, colors, menus, ... cocos2d tutorials gathered here!

Any more to suggest, Dear Readers?]

Continue Reading →
14

Tools: Clang

So we’ve mentioned the LLVM/Clang Static Analyzer already in passing, but there’s enough resources springing up all over to merit some more attention:

Bug Finding With Clang: 5 Resources To Get You Started has usefully descriptive links.

Automated Clang From Xcode has an AppleScript to enhance the convenience.

And for the ultimate in convenience, here is AnalysisTool: a GUI application which allows running both official and their custom analyses!

Well, we wouldn’t want to recommend anything without actual personal experience, so let’s run it over the project we submitted to Apple end of last week…

… OMFG!! 145 — ONE HUNDRED FORTY-FIVE — BUGS!! OK, deep breaths, deep breaths, let’s look at what they are. OK, those are in libvorbis, not actually a problem; and these are in libfaac, nothing immediately fatal there either; and libflac has some too, again no need to panic; and precisely one (a shadowed variable in framing.c, since you asked) in libogg.

And in my source … not a single one. No, not ‘just false positives’, actually no not a single quibble anywhere. We’re not completely certain if that makes us actually as clever as we’d like you to think we are, or just utterly OCD on our coding hygiene. Of course, there’s always the both option isn’t there?

In any case, we thoroughly recommend that no matter what you’re programming for, you familiarize yourself with Clang!

Continue Reading →
0

Tip: iPhone Virtual Memory

“What?” you’re no doubt thinking, “is he going on about? Everyone knows there’s no virtual memory on the iPhone!”

Ah, young padawan, let us correct your misconception. It turns out that, indeed, there actually is. Take a look through this moderately amusing rant about the indeterminacy of memory allotments on the iPhone and into the comments. There’s a variety of suggestions about killing other processes, hogging memory to your own process, and in general going out of your way to not play nice with others; which, well, that’s not the iPhone way, is it now? But then, there’s this piece of solid gold:

There actually is a virtual memory system pager. However you have to manually set it up.
Search for ‘mmap’ in Apple’s iPhone Developer Forum and you’ll find a very informative thread.
Basically, it works like this: In place of malloc, you create a file of the appropriate size and then memory map that file using mmap. The virtual memory pager will page in and out the memory pages as needed. This works both for read-only data (you can just use [NSData dataWithContentsOfMappedFile: ] for that) as well as read-write memory.

Woah. We were utterly and completely unaware that was supported on the iPhone. mmap FTW!

h/t: iPhoneKicks!

Continue Reading →
3

Code: GLGestureRecognizer

This looks nifty; a gesture recognition implementation for the iPhone!

GLGestureRecognizer is a Objective-C implementation of the $1 Unistroke Recognizer, a simple gesture recognition algorithm. It was implemented over the course of a couple evenings in late April 2009 by Adam Preble.

Not that we actually have any immediate use for it, but hey in case something comes up, the code is on github and open source, so there you go!

[EDIT: And the very next day, Mobile Orchard has a post on iPhone Circle Gesture Detection too!]

Continue Reading →
0

Pledging for icons

As you may have noted previously, the artistic skills are not ones of noted accomplishment by trolls. (Aside, that is, from performance art. We’re real good at that, as pretty much anyone who’s met us will attest, we trust.) So we were pleased as punch to stumble across this cleverly named site with a set of nice-looking free UIToolbar/UITabBar icons! We’ll download those immediately, yes…

But wait, what’s this over on the side?

kickstart

a “kickstart”? What is a “kickstart”? Well, it turns out that Kickstarter.com is

Anewway

Kickstarter is a funding platform for artists, designers, filmmakers, musicians, journalists, inventors, bloggers, explorers…

Now that’s intriguing, isn’t it? Here’s the details, but the basic upshot is it’s a website for organizing pledge drives. If enough people sign up to reach the pledge amount, everyone pays their pledge, if not, no one does. An interesting concept, and certainly looks like it has more potential than a donationware model.

So the designer fellow has a project page there where he offers rewards for various levels of pledging, starting with

I make cool icons for iPhone developers at http://glyphish.com and if I can collect $500 in donations, I’ll release the whole set of icons in vector format (SVG + Illustrator) for use in apps, posters, tshirts, whatever!

And that has worked out pretty well for him; it was up to $685 when we arrived, and hey we did think the icons were pretty nice and we were curious to try this Kickstart thing out besides, so we kicked in $20 to see how it went. Which was smoothly. So the nifty idea here appears to be implemented competently, which is always a nice bonus.

So, that certainly is an interesting alternative to consider for funding your development … or anything else … isn’t it? There’s a wide variety of different kinds of projects to explore, but we note with particular interest this project to accumulate enough pledges to remove ads from this iGoozex app. Which, well, we have no use for ourselves, but we’ll certainly be checking back to see how that works out for this fellow with people who do, and if it looks like this concept has some hope of working for developers as well as artists, we’ll see about trying this idea out for some project of our own perhaps. It certainly would be a nifty way of prejudging actual user interest in an application concept!

Continue Reading →
2

Style guides

So, you ever looked at your project with old stuff and new stuff and samples borrowed from hither and yon and thought “sheesh, I seriously need to sort out a consistent style here?” Yeah, us too. So here’s a list of resources to help you out with that.

As always, start at the mothership and check out Coding Guidelines For Cocoa and The Objective-C 2.0 Programming Language.

Then, visit CocoaDevCentral for Coca Style For Objective-C, with a second part as well.

Got some strong opinions now? Good, it’s time to read through this thread on the possible pitfalls that await a poorly chosen strategy of variable naming.

And whether you agree with them or not, it would behoove you to be familiar with the practices in the Google Objective-C Style Guide, part of the google-styleguide project to document the practices used in Google code.

That we believe is a fairly comprehensive rundown of Objective-C focused resources, but then there’s the style of the non-objective bits of C and C++ that will probably be part of your projects as well; and there’s quite a bit more of that around. But a quite sufficient resource for that can be found at this archive of coding style documents. And if nothing you find there fits quite right, why, here is a generator for your own personal style document. We must find some time to play with that one of these days!

[EDIT: And for actively beautifying code, check out this post on use of uncrustify with Xcode!]

Continue Reading →
0
Page 79 of 95 «...5060707778798081...»