Search This Blog

Wednesday 20 March 2013

Toast Message iOS

Hi,
I am going to show you here how to use Toast message and disappear it automatically after some interval.Many users do not want to use UIAlertView because it needs to close manually.Toast shows the message on the screen for the time we specified and will dismiss automatically after time is up.I have not customized the Toast but i am using some files to show the message in Toast.

Steps :
1. Download two files Toast+UIView.h & Toast+UIView.m from here  and add those in project.
2.Link against QuartzCore.
If you are using ARC,then you will need to add the    -fno-objc-arc compiler flag to  Toast+UIView.m.

3.Now in your project,import the files and use the code as per your specifications,


// basic usage
[self.view makeToast:@"This is a piece of toast."];

// toast with duration, title, and position
[self.view makeToast:@"This is a piece of toast with a title." 
             duration:3.0
             position:@"top"
                title:@"Toast Title"];

// toast with an image
[self.view makeToast:@"This is a piece of toast with an image." 
            duration:3.0
            position:[NSValue valueWithCGPoint:CGPointMake(110, 110)]
               image:[UIImage imageNamed:@"toast.png"]];

// display toast with an activity spinner
[self.view makeToastActivity];

Thats it.We are done.
If you face any issue then please comment.
Happy Coding...!

4 comments:

  1. good job dude.... u saved lots of my time.

    ReplyDelete
    Replies
    1. You are welcome..its nice to see that it helped you..

      Delete
  2. -------------------
    Thanks for sharing this information i am bookmark this blog. need more post
    --------------------
    iPhone App Development And
    iOS App Development

    ReplyDelete