How show toast message in objective C – iOS,xcode

Here I have added how to show toast message in iPhone application. Normally it is very easy to show in Android app. But it is bit hard in iOS/Objective C application. Below I have added the source snippet for it. Enjoy it.

NSString *message = @"You are being registered.";            
UIAlertView *toast = [[UIAlertView alloc] 
otherButtonTitles:nil, nil];
toast.backgroundColor=[UIColor redColor];
[toast show];
int duration = 2; // duration in seconds 
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration * NSEC_PER_SEC), dispatch_get_main_queue(), ^{                
	[toast dismissWithClickedButtonIndex:0 animated:YES];            

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s