Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UIAlertController * alertController = [UIAlertController alertControllerWithTitle: @"TODO" message: @"Lägg till en ny TODO" preferredStyle:UIAlertControllerStyleAlert];
- [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
- textField.placeholder = @"Ange vad som ska göras här";
- textField.textColor = [UIColor blackColor];
- textField.clearButtonMode = UITextFieldViewModeWhileEditing;
- textField.borderStyle = UITextBorderStyleRoundedRect;
- }];
- //Button for adding the new TODO
- [alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- NSArray *textfields = alertController.textFields;
- UITextField * todo = textfields[0];
- NSLog(@"%@", todo.text);
- }]];
- //Button for cancelling
- [alertController addAction:[UIAlertAction actionWithTitle:@"Avbryt" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}]];
- [self presentViewController:alertController animated:YES completion:nil];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement