Skip to content

Instantly share code, notes, and snippets.

View RameshAran's full-sized avatar

Arangott Ramesh Chandran RameshAran

View GitHub Profile
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
//todo
}]];
[self presentViewController:alertView animated:YES completion:^{
NSLog(@"alertView shown!");
}];
- (void)showSimpleAlert {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert!"
message:@"This is an Alert."
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
- (void)showAlertWithTwoButtons {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Alert!"
message:@"This is an Alert."
preferredStyle:UIAlertControllerStyleAlert];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
- (void)showAlertWithTextField {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
//Customize the textField
textField.placeholder = @"User name";
textField.textColor = [UIColor whiteColor];
- (void)showAlertWithTwoTextField {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"Menu"
message:@"Select a menu"
preferredStyle:UIAlertControllerStyleAlert];
[alertView addTextFieldWithConfigurationHandler:^(UITextField *textField) {
textField.placeholder = @"User name";
textField.textColor = [UIColor whiteColor];
- (void)showActionSheetWithTwoButtons {
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:@"ActionSheet!"
message:@"This is an ActionSheet."
preferredStyle:UIAlertControllerStyleActionSheet];
[alertView addAction:[UIAlertAction actionWithTitle:@"ok"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
NSLog(@"action - %@", action.title);
NSDictionary *playerVars = @{@"playsinline" : @1,};
if([self.mYTPlayerView loadWithVideoId:@"M7lc1UVf-VE" playerVars:playerVars])
{
self.mYTPlayerView.delegate = self;
}
else
{
NSLog(@"failed loading player");
}
- (IBAction)play:(id)sender
{
if(self.mYTPlayerView.playerState != kYTPlayerStatePlaying){
[self.mYTPlayerView playVideo];
}
}