Search Results

Filtered by:iPhone

Site Search

Search Articles.

Aurora for iPad and iPhone

Thursday 17 Jun 2010 17:23

If you have an iPad or iPhone, and looking for a fun way to make music then this software is for you. Aurora is a pattern based sequencer modelled on the Yamaha Tenori-On that we all know and love.

Checkout the video here.

Tags: Aurora Tenori-On Sequencer Music Software iPad iPhone

Aurora for iPad & iPhone

Thursday 17 Jun 2010 17:05

If you have an iPad, and looking for a fun way to make music then this software is for you. Aurora is a pattern based sequencer modelled on the Yamaha Tenori-On that we all know and love. The features are pretty comprehensive so if you are a seasoned musician there is a tremendous amount of tweakability at your fingertips.

Checkout this video of the iPad version.

Tags: Aurora Tenori-On Sequencer Music Software iPad iPhone

iPhone: Modal Dialogs

Sunday 11 Apr 2010 19:50

Have you ever wondered how to create modal dialogs on the iPhone? Dreamed of simply calling a confirmation dialog and getting back the user input without the need for delegates and messy code.

Read more about modal dialogs here.

Tags: Modal Dialogs UIAlertView iPhone programming

iPhone: Modal Dialogs

Sunday 11 Apr 2010 19:48

If like me you come from a Windows programmer background then you might be surprised at the lack of support for modal dialogs in the iPhone OS. Apple provide you with a UIAlertView which is great for on screen prompts and confirmations, but using them can be quite tedious and require a lot more code than is often neccessary.

This means you can't have code like this

result = CreateModalDialog(NSTitle, NSMsg, @"Ok", @"Cancel");

Instead you have to provide delegates which are called once the user selects an option. In other words your code does not stop and wait for a return value. Whilst this has its benefits in terms of multitasking, your code can get quite messy as you chain these delegates together.

There is another way which involves creating a custom UIAlertView class and a run loop. The code should be self explanatory.

UIAlertView *alert;   
@interface MyUIAlertViewDelegate : NSObject <UIActionSheetDelegate, UIAlertViewDelegate> 
  int result;


@implementation MyUIAlertViewDelegate

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
	result = buttonIndex;

	return result;


int CreateModalDialog(NSString *title,
                      NSString *msg, 
                      NSString *ok, 
                      NSString *cancel)
	// Create an instance of a custom UIAlertViewDelegate that we use to capture
	// the events generated by the UIAlertView
	MyUIAlertViewDelegate *lpDelegate = [[MyUIAlertViewDelegate alloc] init];

	// Construct and "show" the UIAlertView (message, title, cancel, ok are all
	// NSString values created earlier in your code...)
	UIAlertView *lpAlertView = [[UIAlertView alloc] 
otherButtonTitles:ok, nil]; [lpAlertView show]; // By the time this loop terminates, our delegate will have been
// called and we can get the result from the delegate (i.e. what button was pressed...) while ((!lpAlertView.hidden) && (lpAlertView.superview!=nil)) { [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; Sleep(10); } // Grab the result from our delegate (via a custom property) int nResult = [lpDelegate getResult]; // Tidy up! [lpAlertView release]; [lpDelegate release]; NSLog(@"Result: %d", nResult); return nResult; } @end;

Tags: Modal Dialogs UIAlertView iPhone programming

iPhone: Creating a custom UIAlertView Busy Dialog

Wednesday 31 Mar 2010 21:34

Have you ever wanted to create a "Please Wait" dialog on the iPhone without having to implement a custom UIView?  In this article I explain how to cusomize a UIAlertView dialog in order to achieve the same effect.

Click here to view the article.

Tags: UIAlertView iPhone Custom

iPhone: Creating a custom UIAlertView Busy Dialog

Wednesday 31 Mar 2010 17:59

One of the major problems facing iPhone developers, especially those coming from a Windows environment  is the lack of dialogs. We use dialogs when we require user input or need to display feedback.  I recently needed to display a 'Please Wait' dialog whilst downloading files from a web server, and found a way to do this using a UIAlertView.

The iPhone's UIAlertView generally displays an on screen message allowing the user to select one or more options as in the image below.

In the case of a "Please Wait" dialog we don't require any buttons and need to insert a UIActivity indicator inside the dialog. Generally speaking you can embed most UI elements inside a UIAlertView, but to do this you need to expand the dialog, which you can do by inserting a series of returns in the message body. In my case removing the buttons gives me ample room to insert the activity indicator.

UIAlertView *WaitPrompt()
  UIAlertView *alert = [[[UIAlertView alloc] 
    initWithTitle:@"Contacting Server\nPlease Wait..." 
    message:nil delegate:nil cancelButtonTitle:nil
    otherButtonTitles: nil] autorelease];
  [alert show];

  UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50); [indicator startAnimating]; [alert addSubview:indicator]; [indicator release]; // 250ms pause for the dialog to become active... int n=0; while(n < 250) { [[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode]; Sleep(1); n++; } return alert; }

We can call the above routine to create our wait dialog, but how do we dismiss the dialog once we have completed our task?

void DismissWaitPrompt(UIAlertView *alert)
	[alert dismissWithClickedButtonIndex:0 animated:YES];

Please pay special attention to the while() loop at the end of the WaitPrompt() function. This section of code executes the main run loop for 250ms which is enough time for the OS to animate the UIAlertView onto the display. If you omit this section of code the chances are the dialog would not display until your processing is complete.

Tags: iPhone UIAlertView Custom programming

Programming Tips

Friday 12 Mar 2010 21:43

In my real life I've been a software engineer and C++ programmer for the past 20+ years! (A fact I was only reminded of today, and one that I don't like to contemplate for too long).

I've worked on many platforms including Windows, Windows Mobile, iPhone, DS, DSi and many more. I know from experience how difficult it can be to find good information and tutorials. I am not quite sure how this section is going to pan out, and if I will be posting tutorials or code snippits.

Time will tell...

Tags: programming iPhone Windows Mobile


Sites of Interest