This is a UIAlertView that has a button linking to this website. It implements the UIAlertView delegate on self.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"About"
message:@"Application developed by Kevin Yavno\n\nVersion 1.0"
This is the implementation of the UIAlertViewDelegate. It’s not the best practice to compare the button title to a hardcoded string, but it gets the job done in this simple app.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://kevinyavno.com"]];
Here is an example of how to present iOS’s built in Tweet Compose View. This code simple allocs the view controller, then sets the initial text. After setting the completion handler using a closure (lambda function if you want to get technical) it then finally presents it overtop of our current view.
You need to link the Twitter.framework library with your source to use this code.
This code moves a button called “shareCurrentlyBtn” 150 pixels in the Y (vertical) direction. This code handles the animation programatically.
This code creates an input-dialog with AlertDialog.Builder where a user can enter text in an EditText field and press on “Ok” and “Cancel”.
This is part of my AudioViz project on GitHub. This service broadcasts an Intent (com.app.playing) when it starts to play. I did this because I found that there was a delay between when I started the service, and when the music was playing which caused NullPointerExceptions. Elsewhere in the code, I have a Broadcast receiver listening for this broadcast upon which the rest of initialization code is run.
A Postfix Calculator implemented using a Stack in Java:
This post will show you how to have a disappearing menu in your android apps. The menu should be hidden until the user taps the screen, and then the menu will disappear after 5 seconds unless the user taps the screen again. What I’ll show is how to make a simple button disappear, but this technique can be adapted to anything that can be animated.