Great tool for iPhone Mockups

Used OmniGraffle to produce mockups for my latest iPhone project, its pretty easy yo use and there are a number of good stencils that allow for most of the UI Kit controls and even the iPad!


Objective C documentation generation

Found a useful tool Doxygen that will scan through your source code and generate documentation in an HTML format.


Programmatically Exit iPhone App

To terminate your app from within your code execute the following command…

exit(0);


UIAlertView with UITextField – REJECT

A project I’m working on contains an alert that uses the addTextFieldWithValue:label: private API, this approach has been popular/recommended by a number of developers/blogs, but now that Apple have their automated checking for Private API’s any apps using this technique will be rejected….

“3.3.1 Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs.”

The following non-public APIs are included in your application:
addTextFieldWithValue:label:
textFieldAtIndex:

Jeff LaMarche has a great article that shows an alternative, that doesn’t use any Private API’s and therefore shouldn’t get you rejected.


XCode SCM column in Xcode project treeview

If you can’t see the column to the left of project files that shows the SVN status of a file, right-click the “Groups & files” title and select SCM

Groups & Files - SCM


__MyCompanyName__

The template that creates your .h and .m files within Xcode by default sets the company name to __MyCompanyName__

To correct perform the following…

1) Start up the program Terminal Utilities/Terminal
2) Enter the following where XXXXXXXXXXXXX is what you want to appear in place of __MyCompanyName__:
defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions ‘{”ORGANISATIONNAME” = “XXXXXXXXXXXXX”;}’
3) Press enter
4) Shut down and restart Xcode.


Finding Build Errors

To quickly jump to build errors within your iPhone app, use the short cut combo of ⌘=


Label with line breaks

To have a label recognise line breaks in the text that you enter in the Interface Builder, set the number of lines to 0, and when you want a new line press both the Option key and the Return key


Core Data – Updated model

After creating a new version of your data model, and adding the relevant code to handle lightweight migration, to actually get your code to run ensure that you do a clean all targets otherwise you get merge model errors!


iPhone mipmaps

Here is some code that shows the glTexParameterf values that need to be set to automatically generate mipmaps and to get OpenGL to use them

glBindTexture(GL_TEXTURE_2D, texture[0]);

//Next 2 lines are required if not mipmap
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

//Next 3 lines required if mipmap
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_GENERATE_MIPMAP, GL_TRUE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texWidth, texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData);


Previous Entries