Growl/toast style notifications library for iOS
I created a solution that I think you'll find useful:https://github.com/scalessec/toast
It's written as a obj-c category, essentially adding makeToast methods to any instance of UIView. eg:
[self.view makeToast:@"Profile saved" duration:2.0 position:@"bottom"];
I solved it this way:
- Create common label on your view. Make it all screen wide, give it the size you will need and center text in it.
- Set it's position "on top" - this label must be below all of your controls in the list of controls.
- Add it to interface, properties, synthesize (let's call it "toastLabel" there).
- Associate in your XIB file with "toastLabel"
Add following line to your viewWillAppear to hide label for beginning:
[toastLabel setHidden:TRUE];
Add the following code on Button click (or some other event):
toastLabel.text = @"Our toast text";[toastLabel setHidden:TRUE];[toastLabel setAlpha:1.0];CGPoint location;location.x = 160; location.y = 220; toastLabel.center = location;location.x = 160; location.y = 320; [toastLabel setHidden:FALSE];[UIView animateWithDuration:0.9 animations:^{ toastLabel.alpha = 0.0; toastLabel.center = location;}];
This label will "fall down" and disappear.
Albeit a little late, here's my take on it: