Recently I posted a basic graph view but the way that I implemented it might have made it hard for others to use. So i have rewritten this graphing engine into a project that you can download below. In this example I have made it so that the graph data is randomly generated. This allows people who are learning how a simple graphing engine works can focus on the graphing rather than adding data.

When you do want to remove the randomly generated data and insert your own data, their is a method i have already created. It is called addPoint. After you have added our data and want the table drawn you must call collectionFinished, this function will tell the view to draw itself and your data.

Note: In this example i have added the ability to scroll horizontally through your data when you have more then 460 data items. This is done through touch dragging your finger across the screen.

Please comment if you have any questions.


DOWNLOAD SOURCE


When creating my own custom graphing engine I had wanted to have very thin (1px) grid lines so that the data lines would stand out by being thicker. Now you might be thinking well by default when using CG drawing the lines are 1px. This is true but when they are draw half a pixel is drawn on each side making them 2px lines.There is a trick however to overcome this, and it is to offset the lines start and end point by half a pixel in the y-axis. This prevents CG from drawing the added half pixel on each side. So in effect you get a true 1px line.

So for example if your line was going to be from (10 , 30) to (20 , 30) instead make it from (10 , 30.5) to (20 , 30.5)

Hope this helps:)


I read this on a blog this morning and found it hilarious. When a user asks which programming language to learn next one user replied:

Depends.

To program in an expressive and powerful language: Python
To get a website up quickly: PHP
To mingle with programmers who call themselves “rockstars”: Ruby.
To really learn to program: C.
To achieve enlightenment: Scheme.
To feel depressed: SQL
To drop a chromosome: Microsoft Visual Basic
To get a guaranteed, mediocre, but well paying job writing financial applications in a cubicle under fluorescent lights: Java.
To do the same thing with certifications and letters after your name: C#
To achieve a magical sense of childlike wonder that you have a hard time differentiating from megalomania: Objective C

I could go on… but I’m not feeling hateful enough today.


Today while doing some messing around in xcode i found a nice easy way to start your programs in lanscape mode.Add this code into your first view controller:
// Override to allow orientations other than the default portrait orientation.
– (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
if (interfaceOrientation !=UIInterfaceOrientationPortrait) {
return TRUE;
} else {
return FALSE;
}

}


NOTE: There is a new and better tutorial about graphing. View my other tutorials to find it.

When i was trying to create a basic line graph for my last project i found that there was neither a solution in the SDK nor much help online from fellow developers. There is a more complicated but very nice solution called CorePlot.

However as basic line drawing is relatively easy with CorGraphic I have made my own GraphView Class.

To use it simply:

  • import it in your header
  • initialise it with [[GraphView alloc] init];
  • Add points to it using its addPoint method.

Note:
At the moment the addPoint method is setup to accept UIAccelerationValues so you will need to modify it to accept float instead.
Also at the moment the maximum number of points is 300. This can also be easily modified.

Download Graph View Source Code Here.


When i was trying to learn how to do basic animation for moving layers i found that not many boks or online resources could effectively communicate what needed to be done. Finally i found out how to do it an easy way. This does not need any other frameworks added in. This example animates the movement of a button to the point (200,200) over 0.3 seconds.
The Setup:
You have a button in your view called myButton.
The Code:
//Set up animation duration and delegate
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:self];
//This allows you to set a method that will be called when the animation finishes
[UIView setAnimationDidStopSelector:@selector(growAnimationDidStop:finished:context:)];
//This sets the new center for the button
myButton.center = CGPointMake(200,200);
//This starts the animations
[UIView commitAnimations];

I have just released v1.2.1 of my iPhone app. The new version has a completely new user interface which looks GREAT !


After several painfully long hours I have just finished uploading Diet4Blood v1.2.0 to the app store. Mind you this is v1.2.0 their shouldnt be any problems uploading it to the app store because i already did v1.1.0. The reasons for this struggle:

Xcode IDE
Apples Frustrating Provisional Profiles

Whats wrong with xcode you may ask? You think it is a great IDE? Well your wrong. I mean your right it is great but its also terrible at the same time.

So the problem that i continue to run into with it is a weird set of complicated bugs. Many times you select a setting that you want to change. You change it and it looks like its done…. if only it was that easy. No instead after much digging i looked at the xcode project in textEdit (notepad for mac) and it appears that it doesn’t actually change the settings. Instead it seems to duplicate the setting and change one of them, the one that shows up in xcode, but then when compiling it uses the second GRRRR.

Let me quickly explain provisioning profiles. Apple makes the developer create a provisioning profile which links the developers Apple ID with any development or distribution devices. This allows apple to control who are developing their apps and distributing them. So I lied earlier they are a good idea but the just seem to be very buggy.

When you attempt to upload an app to the app store it sometimes tells you that it is signed with the wrong profile or not one at all. This can take hours to find what is wrong but usually it is the problem with xcode and its “fake” settings, which i described above.

So in response to sprouting grey hairs from these problems i am going to write a few tutorials on provisioning profiles and troubleshooting uploading apps to the app store.

Until next time:

“Computers are getting smarter all the time. Scientists tell us that soon they will be able to talk to us. (And by ‘they’, I mean ‘computers’. I doubt scientists will ever be able to talk to us.)”
(Dave Barry)


Diet4Blood was successfully launched today. This is really exciting to finally have my first app on the app store.

iTunes:
http://www.linktoapp.com/Diet4Blood

Version 1.2 coming soon.


This time i am not going to complain about the new OS but instead state some cool new features that i liked.

Multitasking:
The new OS will allow third party apps to run in the background while you change to another app. This means you could be playing Tap Tap revenge, then remember you have to send an email, now instead of closing tap tap and losing your potential high score you can just double click on the home button and it will bring up a horizontal list of apps that are currently running. Here you can switch to mail, send your email, then by using the double click go back to tap tap and continue on mid game.

Set Wallpaper:
You can now set any picture you like as your wallpaper. This picture will displat behind all your apps.

Bluetooth Keyboard:
This i thought was a really cool yet totally ignored feature of the new OS. It will allow users to connect, via bluetooth, a wireless keyboard to your iPhone. This can then be used to type text into anywhere. This will increase efficiency when creating notes as well as open up a new market for text heavy apps.

iAds:
Now you may be thinking why am i excited about ads. Well i really cant explain it you really need to watch jobs sell it to you:P. Basically he describes iAds as being the missing link between TV ads(emotional based) and internet ads(interactivity based). iAds will allow developers ta add effective professional ads to their free apps, giving them a source of income for the app.

This will promote developers creating free apps as now they are able to gain income through it. The main feature that jobs stressed about these ads is that when you clock on the ad banner it does NOT take you to an external page drawing attention away from your current app. Instead it occupies the full screen but is able to be closed (one touch) to return you back to your original app.

Folders:
Finally we non jail broken iPhone users can have folders. By dragging an app on top of another app you automatically create a folder. These folders can be renamed, repositioned and even placed in the home bar(4 favourite apps at bottom).

Gaming Centre:
I am not really a iPhone gamer so this was not a big deal to me but nether the less it is an amazing functionality that i dont think any other smart device has. In a nut shell it is XBOX Live on your iPhone. You can challenge people to games, check your achievements and also check progress through games.

In the keynote jobs admits that they weren’t the first to many of these features but he claims they will be the best at them. Fingers crossed.




Follow

Get every new post delivered to your Inbox.