ITP 342 Mobile App Dev. Alerts



Similar documents
Send from your App Part 1

2. Create the User Interface: Open ViewController.xib or MainStoryBoard.storyboard by double clicking it.

YOUR GUIDE TO THE iphone MOBILE APP WITH 1st SOURCE

SUMMARY. e-soft s.r.l.

INTRODUCTION TO IOS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 13 02/22/2011

View Controller Programming Guide for ios

How can I protect against the loss of my ID if my device is lost or stolen?

Sophos Mobile Control User guide for Apple ios

Sophos Mobile Control User guide for Apple ios. Product version: 2 Document date: December 2011

FirstClass for Mobile -

Setting up Channel-21 Secure RSS CEP on

Fibaro Intercom for ipad

Praktikum Entwicklung von Mediensystemen mit ios

Setting Up groov Mobile Apps. Introduction. Setting Up groov Mobile Apps. Using the ios Mobile App

Business Mobile Banking

Online Banking Upgrade FAQs

OFFICE 365 SELF- CONFIGURATION GUIDE

Sophos Mobile Control User guide for Apple ios. Product version: 4

Customize Mobile Apps with MicroStrategy SDK: Custom Security, Plugins, and Extensions

DocuSign for Salesforce Administrator Guide v6.1.1 Rev A Published: July 16, 2015

DocuSign Connect for Salesforce Guide

User's Guide. [Home Network] app. Model No.

BlackBerry Universal Device Service. Demo Access. AUTHOR: System4u

Time Matters for Microsoft Outlook. Technology Preview User Guide

1. Introduction What is Axis Camera Station? What is Viewer for Axis Camera Station? AXIS Camera Station Service Control 5

Access the TCNJ Palo Alto Networks VPN using the GlobalProtect VPN client

EZ RMC Remote HMI App Application Guide for ios

B&SC Office 365

Selection Manager: Quick Start Guide

EMR Link Server Interface Installation

EMPLOYEE SELF-SERVICE DIRECT DEPOSIT PROCEDURES

Set up Delegate & Travelers

Phone: Fax: Box: 230

user guide phone 2015 by Sysco. All rights reserved.

DarwiNet Client Level

- Spam Spam Firewall How Does the Spam Firewall Work? Getting Started username Create New Password

Citizens 1 st National Bank Mobile Banking FAQ

idmss(ipad/iphone) Mobile Client Software User s Manual

Tufts University Human Resources New Hire Benefits Enrollment

Bright House Networks Home Security and Control Mobile Application

Start Developing ios Apps Today

Bright House Networks Home Security and Automation Mobile Application. Quick Start Guide

Setup Guide. network support pc repairs web design graphic design Internet services spam filtering hosting sales programming

Exchange ActiveSync (EAS)

Health Science Center AirWatch Installation and Enrollment Instructions For Apple ios 8 Devices

Mobile Device Management AirWatch Enrolment ios Devices (ipad, iphone, ipod) Documentation - End User

ONLINE ACCOUNTABILITY FOR EVERY DEVICE. Quick Reference Guide V1.0

DocuSign for Microsoft Dynamics CRM

Authorize.Net Mobile Application

How to configure your Desktop Computer and Mobile Devices post migrating to Microsoft Office 365

First Time On-Campus Remote Desktop Connection ipad Edition

FAQs. OneDrive for Business?

ios Development Tutorial Nikhil Yadav CSE 40816/60816: Pervasive Health 09/09/2011

Produced by: Flinders University Centre for Educational ICT

Synergy SIS AdminVUE Administrator & User Guide

The Peer Reviewer s Guide to Editorial Manager

USER GUIDE PowerAttachment CRM

mystanwell.com Installing Citrix Client Software Information and Business Systems

Microsoft Outlook Quick Reference Sheet

Mobile Iron User Guide

STX Beacon User Guide. Credit Card Processing Mobile Devices Mac & Windows OS

Customer Relationship Management Software

Quick Start Guide Mobile Entrée 4

Jobulator Mobile Overview for ios (iphone, ipad, ipod Touch)

MOBILE DEVICE CONFIGURATION GUIDE ActiveSync

SCDOT FTP Server User Guide

Configuration Guide Contigo Mobile Tracker

CinePlay User Manual

Baylor Secure Messaging. For Non-Baylor Users

TWO WAYS TO SCHEDULE A SCOPIA VIDEO CONFERENCE BASED MEETING. 1- SCOPIA USER PORTAL 2- OUTLOOK SCOPIA MEETING PLUG-IN

Mobile App Frequently Asked Questions

Setting up your 32GB District ipad

Mobile Application Development

ITP 342 Mobile App Development. Notifications

Faculty & Staff Guide for Outlook Web App (OWA) Prepared by Information Technology Division Lehman College July 11, 2013

Microsoft Tag Scanning SDK for iphone & Android Apps

How to configure Mac OS X Server

Law School Computing Services User Memo

Mobile Connect for USA Mobility Pagers for iphone

mydlink DCS-930L/932L Cloud Cam Advanced Settings Setup Guide

emobile Bulk Text User Guide Copyright Notice Copyright Phonovation Ltd

User manual VU-Mail Webmail Outlook Web App februari 2010

SHAREPOINT 2010 FOUNDATION FOR END USERS

Northwestern University On-line Application Tip Sheet

Building Applications with ArcGIS Runtime SDK for ios Part II. Eric Ito and Scott Sirowy

ios Deployment Simplified FileMaker How To Guide

First Data Global Gateway iphone App User Manual

Welcome to Marist College s new Voic system. Recording your Greeting. Contents of this Booklet. First Time Users, What do I need to get started?

ireadsmime User Guide For iphone, ipad, and ipod Touch

How to pull content from the PMP into Core Publisher

MS Word Microsoft Outlook 2010 Mailbox Maintenance

RSC-Secure-Wireless provides...

Table of Contents. Description of the BlackVue App 3. Supported Devices 4. Screen Description 5. Home Screen 5. Video List Screen 6

Talk-101 User Guide. DNSGate

PORTLANDDIOCESE.ORG - How to Connect Table of Contents

MC3WAVES Wireless Connection Wizard

Wind River Financial iprocess Setup Guide for IOS Devices

TriCore Secure Web Gateway User Guide 1

Transcription:

ITP 342 Mobile App Dev Alerts

Alerts UIAlertController replaces both UIAlertView and UIActionSheet, thereby unifying the concept of alerts across the system, whether presented modally or in a popover. Unlike the classes it replaces, UIAlertController is a subclass of UIViewController. As such, alerts now benefit from the configurable functionality provided with view controller presentation. 2

Alerts UIAlertController is initialized with a title, message, and whether it prefers to be displayed as an alert or action sheet. Alert views are presented modally in the center of their presenting view controllers, whereas action sheets are anchored to the bottom. Alerts can have both buttons and text fields, while action sheets only support buttons. Rather than specifying all of an alert's buttons in an initializer, instances of a new class, UIAlertAction, are added after the fact. Refactoring the API in this way allows for greater control over the number, type, and order of buttons. It also does away with the delegate pattern favored by UIAlertView & UIActionSheet in favor of much more convenient completion handlers. 3

New Functionality UIAlertController is not just a cleanup of preexisting APIs, it's a generalization of them. With UIAlertController, it's possible to do a lot more out-of-the-box. Alert with Destructive Button Alert with >2 Buttons Login Form Sign Up Form 4

A Standard Alert 5

Using UIAlertView Deprecated in ios 8 Alert in ios 5-7 Put the following code in a method when you want to display an alert UIAlertView *alertview = [[UIAlertView alloc] initwithtitle:@"defaultstyle" message:@"the default alert view style" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil]; [alertview show]; 6

Alert in ios 8 UIAlertController *alertcontroller = [UIAlertController alertcontrollerwithtitle:@"basic Alert Style" message:@"basic Alert With Buttons" preferredstyle:uialertcontrollerstylealert]; UIAlertAction *cancelaction = [UIAlertAction actionwithtitle:@"cancel" style:uialertactionstylecancel handler:^(uialertaction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okaction = [UIAlertAction actionwithtitle:@"ok" style:uialertactionstyledefault handler:^(uialertaction *action) { NSLog(@"OK action"); }]; [alertcontroller addaction:cancelaction]; [alertcontroller addaction:okaction]; [self presentviewcontroller:alertcontroller animated:yes completion:nil]; 7

Destructive Buttons UIAlertController *alertcontroller = [UIAlertController alertcontrollerwithtitle:@"basic Alert Style" message:@"basic Alert With Buttons" preferredstyle:uialertcontrollerstylealert]; UIAlertAction *cancelaction = [UIAlertAction actionwithtitle:@"cancel" style:uialertactionstylecancel handler:^(uialertaction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *resetaction = [UIAlertAction actionwithtitle:@"reset" style:uialertactionstyledestructive handler:^(uialertaction *action) { NSLog(@"Reset action"); }]; [alertcontroller addaction:resetaction]; [alertcontroller addaction:cancelaction]; [self presentviewcontroller:alertcontroller animated:yes completion:nil]; 8

A Standard Action Sheet 9

Action Sheet in ios 5-7 Using UIActionSheet Deprecated in ios 8 Put the following code in a method when you want to display an action sheet UIActionSheet *actionsheet = [[UIActionSheet alloc] initwithtitle:@"is it story time?" delegate:self cancelbuttontitle:@"no" destructivebuttontitle:nil otherbuttontitles:@"absolutely", nil]; [actionsheet showinview:self.view]; 10

Action Sheet in ios 5-7 Use delegation // implement action sheet delegate method - (void) actionsheet: (UIActionSheet *) actionsheet clickedbuttonatindex: (NSInteger) buttonindex { if (buttonindex = [actionsheet cancelbuttonindex]) { [self createstory]; } } 11

Action Sheet in ios 8 UIAlertController *alertcontroller = [UIAlertController alertcontrollerwithtitle:@"archive or Delete Data" message:@"deleted data cannot be undone" preferredstyle:uialertcontrollerstyleactionsheet]; UIAlertAction *cancelaction = [UIAlertAction actionwithtitle:@"cancel" style:uialertactionstylecancel handler:^(uialertaction *action) { /* code */ }]; UIAlertAction *deleteaction = [UIAlertAction actionwithtitle:@"delete" style:uialertactionstyledestructive handler:^(uialertaction *action) { /* code */ }]; UIAlertAction *archiveaction = [UIAlertAction actionwithtitle:@"archive" style:uialertactionstyledefault handler:^(uialertaction *action) { /* code */ }]; [alertcontroller addaction:cancelaction]; [alertcontroller addaction:deleteaction]; [alertcontroller addaction:archiveaction]; [self presentviewcontroller:alertcontroller animated:yes completion:nil]; 12

Action Sheet The previous code will work great on iphones The cancel button, if present, is always shown as the bottom of the view regardless of the order it was added to the alert controller. The other actions are shown top to bottom in the order they were added. The ios Human Interface Guidelines recommend that any destructive action is shown first. The previous code will create a runtime exception on ipads 13

Action Sheet on ipad The action sheet is displayed in a popover. A popover always requires an anchor point which can be a source view or a bar button item. We use a standard UIButton to trigger the action sheet so let's use it as the anchor point. A big difference in ios 8 is that we no longer need to write code to test for the interface idiom. The UIAlertController takes care of adapting to the display environment so we can simply ask it for a popover controller. On an iphone/compact width device this returns nil. 14

Action Sheet on ipad Add extra code to configure the popover UIPopoverPresentationController *popover = alertcontroller.popoverpresentationcontroller; if (popover) { popover.sourceview = sender; popover.sourcerect = sender.bounds; popover.permittedarrowdirections = UIPopoverArrowDirectionAny; } 15

Text Input Alerts 16

Text Input Alerts The greater flexibility of the UIAlertController means that you no longer need to be constrained by the built-in styles for plain text, secure text or login and password input alert views. We can add an arbitrary number of UITextField objects to the alert and use all of the standard UITextField configuration options. When you add the text field to the alert controller you specify a block that is used to configure the text field. 17

Text Input Alerts UIAlertController *alertcontroller = [UIAlertController alertcontrollerwithtitle:alerttitle message:alertmessage preferredstyle:uialertcontrollerstylealert]; [alertcontroller addtextfieldwithconfigurationhandler:^(uitextfield *textfield) { textfield.placeholder = NSLocalizedString(@"LoginPlaceholder", @"Login"); }]; [alertcontroller addtextfieldwithconfigurationhandler:^(uitextfield *textfield) { textfield.placeholder = NSLocalizedString(@"PasswordPlaceholder", @"Password"); textfield.securetextentry = YES; }]; actionwithtitle:nslocalizedstring(@"ok", @"OK action") style:uialertactionstyledefault handler:^(uialertaction *action) { UITextField *login = alertcontroller.textfields.firstobject; UITextField *password = alertcontroller.textfields.lastobject;... }]; 18

Resources http://nshipster.com/uialertcontroller/ http://useyourloaf.com/blog/2014/09/05/ uialertcontroller-changes-in-ios-8.html 19