Wednesday, 4 July 2012

Top Tip

How many times have you had to do something like this

int count = [NSArray count]
count--;

to allow for the 0 index?

i.e if it has a count of 3 it actually contains index 0,1,2

try using this instead

#define minus(x)(x - 1)

[array objectAtIndex:minus(count)];

saves times and lines.

Tuesday, 3 July 2012

Notification Centre Drop Down, What a Nightmare

Nightmare might be a bit strong, but under certain circumstances it can prove to be one. 

"I can't switch it off"

The main problem is, I am unable to switch it off. I have an app which uses swipe gestures for interaction. More than once now the Notification Centre has dropped down whilst I'm in the middle of using the app. What makes this worse is the fact that the app is a test and by this NC fault it invalidates the data.

The Answer

There is accessibility support commingling in iOS 6, however since we have a load of iPad(1) (which won't run the new version of the operating system), this option isn't available to us.

Come on apple, give us a way to switch this off - please!

Monday, 11 June 2012

preventing a race condition when using two TapRecognizers

I recently had a problem where I had a single tap recogniser and a double tap recogniser. The problem was when someone performed a double tap, the app was also detecting a single tap.

Luckily there is a really easy solution to this.

Stack Overflow Question

Tuesday, 29 May 2012

Prototyping

Yes prototyping is on the agenda today.

I am yet to come across a good system for prototyping iOS apps. I have seen several apps that allow you to make mock up interfaces; but not a single one provides quite the level I require, in fact its a bit disappointing. All of the prototyping apps I have come across seem very simplistic and smart looking, but provide little depth when it comes to functionality. Really what I would like is a prototyping program that allows you to add your own scrip, for modifying the interaction. If any one is reading this and thinking "I know one such app" please post a comment and ill check it out.

I am now looking at new possibilities of prototyping. I even considering looking into flash player, but I think that might be going to far the other way. ATM I have been writing the prototypes in Objective C. The problem is, its just too lengthy a process.

If I find a prototyping app that provides high level functionality, ill let you know.

Thursday, 15 March 2012

NSValue

Top Tip

Using NSValue to wrap c types saves time and energy when it comes to debugging.

CGPoint point;

NSValue *val = [NSValue valueWithCGPoint:point];

CGPoint returnPoint

[val GetValue:&returnPoint];

Thursday, 8 March 2012

Condition Operator

I love this neat c trick: The condition operator. It makes my code so much tidier

e.g

return(x < 3)? YES : NO;

as opposed to:

if(x < 3){
         return YES;
}else{
         return NO;
}

Wednesday, 7 March 2012

iOS app testing

It is that time again where software testing ( BETA) is going to start happening. I  have often wondered about people different testing techniques. If anyone has a protocol or process for writing testing I would be interested to hear them.

Wednesday, 29 February 2012

School boy error

Note to self: When implementing a UITouchGestureRecogniser make sure that it doesn't cover the UINavigationBar or else it will override the buttons.

Friday, 10 February 2012

Doxygen

Have configured Doxygen using the link below. Unfortunately I haven been bole to get a perl scrip to run in Xcode's behaviour settings.

Tutorial on setting up Doxygen on Xcode

Still not convinced that it works sufficiently in Xcode but ill have another look at it later.

Wednesday, 8 February 2012

NSMutableDictionary and Ordering

Interesting little problem:

I have a mutable dictionary but when I call NSArray = [NSMutableDictionary allObjects];

I get an array of objects but they are in a different order to the order I added them to the dictionary.

So now I have to set up some kind of sort function.

Monday, 30 January 2012

Documenting a iOS app

I have been wondering for some time what the best way to document iOS apps is? When I have programmed in Java in the past I have always used Java Doc. I have heard of different 3rd party programs i.e Doxygen. But I'm not sure whether to invest the time in getting it set up.

Any thoughts

Wednesday, 25 January 2012

Problems with GIT

I have recently started using vision control, more specifically Git. Git is supposed to manage the different branches you have of a app and allow you to switch between them quick and easily. Xcode has built in Git integration. The question is: Are you putting all your eggs in one basket by using Git?

Today I found out that my git repository had corrupted and that I am unable to navigate between the different branches of my program. Whats worse is that it corrupted ages ago and I hadn't noticed because I haven't needed to change branch. The only lucky thing is that I manually kept a copy of the different branches because I was sceptical of git from the start.

Id be interested in what other programmers think of the version system Git?

Wednesday, 18 January 2012

Spotlight not find files and folders

Recently I have been noticing that spotlight hasn't been able to find my searches. I don't know if this is a common error? But appears that spotlight hasn't been indexing new files I have been adding to my mac. After re-indexing it works fine. So the question is: is there a bug in Spotlight?

Monday, 16 January 2012

Spotlight Not Finding Searches?

I recently discovered that spotlight is not finding my searches. So I decide to re index the mac and now its working.

Go to spotlight preferences

Add your hard drive to the list of private files.

Re-boot and remove from the list of private files and spotlight will re-index.

Monday, 9 January 2012

UISplitViewController Problem

I have been trying to implement a UISplitViewController in my storyboard with no success. The only way I can see to do it by coding in a UISplitViewController. But I was hopping that there would be a way to do it with a Segue. I even tried writing my own custom Segue with no luck.

Any Ideas let me know

Cheers

Wednesday, 4 January 2012

Dismissing the keyboard

for(UIView *subView in [self.view subViews]){
     [subView resignFirstResponder];
}

Is this really the best way to insure the keyboard is dismissed? Surly there has to be a better way than using resign first responder?