Declared in UIViewController+SCCustomViewController.h

Overview

This UIViewController category provides convenience methods for instantiation and launch of C2Call SDK GUI component.

The C2Call SDK provides feature rich components for rich media content handling and social media communication features. The basic concept of this SDK is, to combine convenience and ease of use with great flexibility for all provided components. The UIViewController+SCCustomViewController category provides easy access to those components, whether they will be used as standard components from SCStoryboard or as customized components from the MainStoryboard of the developed application.

In iOS Storyboard an UIViewController represents one screen of content and the transitions between two UIViewControllers will be defined by an UIStoryboardSegue. In C2Call SDK the UIViewController based GUI components will be also presented via UIStoryboardSegue, so that the developer can define the transition in his MainStoryboard. Several components require one or more parameters, which typically have to be set in method prepareForSegue:sender. The UIViewController+SCCustomViewController provides convenience methods to present C2Call SDK GUI components with a one or two lines of code and ensures that required parameter will be correctly set in the presented ViewController.

The following GUI components are supported:

Presenting Rich Media Content
- SCComposeMessageController (Composes and submit a new Instant Message, 
  Rich Media Message or SMS/Text Message to a user or phone number)
- SCPhotoViewerController (Presents photos)
- SCVideoPlayerController (Presents a Video Player)
- SCLocationViewerController (Presents a location in a map view)
- SCAudioPlayerController (Presents an Audio Player for VoiceMails)

Capture Rich Media Content:
- UIImagePickerController (Captures an Image or Video from Camera or Photo Album with Quality)
- SCAudioRecorderController (Records and submits a VoiceMail)
- SCLocationSubmitController (Picks and submits the current location or nearby Google places)

Show Friends, Groups and Chat History:
- SCChatController (Presents a Chat History with a specific contact)
- SCFriendDetailController (Presents the details of a connected friend)
- SCGroupDetailController (Presents the details of a connected group)

Others:
- SCBrowserViewController (Opens an URL in a Browser View)

In case the developer connects the above components in his MainStoryboard via UIStoryboardSegue the segues have to be named with a specific name convention in order to handle the parameters setup in prepareForSegue:sender correctly. Each connected UIStoryboardSegue has to be named like the target ViewControllers original class name, for example:

Target UIViewController Class           Segue Name
SCComposeMessageController      ->      SCComposeMessageControllerSegue
SCPhotoViewerController         ->      SCPhotoViewerControllerSegue
SCVideoPlayerController         ->      SCVideoPlayerControllerSegue
SCLocationViewerController      ->      SCLocationViewerControllerSegue
etc.

In addition to this naming convention, the developer needs to call customPrepareForSegue:sender in his prepareForSegue:sender method:

-(void) prepareForSegue:(UIStoryboardSegue*) segue sender:(id) sender
{
    [self customPrepareForSegue:segue sendersender];

    // Do your own setup
}

All ViewControllers covered by this UIViewController category can be also presented without UIStoryboardSegue connections. In this case the component will be instantiated from MainStoryboard and if not found there, from SCStoryboard. It’ll push the component if the current ViewController is embedded in a UINavigationController and present modal else. We recommend to use UIStoryboardSegue if the developers wants to have full control on this behavior.

Tasks

Other Methods

Instantiate SDK ViewControllers

Segue Handling

Compose Message

Present Rich Media Items

Show Object Details

Open Browser View

Open Country Selection

Capture Rich Media Items

Instance Methods

addCancelButtonIfNeeded

- (BOOL)addCancelButtonIfNeeded

addCloseButtonIfNeeded

- (BOOL)addCloseButtonIfNeeded

captureImageFromAlbumWithQuality:andCompleteAction:

Captures an Image from Album for submission using UIImagePickerController.

- (void)captureImageFromAlbumWithQuality:(id)quality andCompleteAction:(id)completion

Parameters

quality
  • The requested Image Quality. If the original image has a higher resolution, it’ll be scaled down automatically
completion
  • Completion Handler, will be called with the Rich Media Key of the image when done

Declared In

UIViewController+SCCustomViewController.h

captureImageFromAlbumWithQuality:andCompleteAction:usingPhotoEffects:

Captures an Image from Album for submission using UIImagePickerController.

- (void)captureImageFromAlbumWithQuality:(id)quality andCompleteAction:(id)completion usingPhotoEffects:(id)useEffects

Parameters

quality
  • The requested Image Quality. If the original image has a higher resolution, it’ll be scaled down automatically
completion
  • Completion Handler, will be called with the Rich Media Key of the image when done
useEffects
  • Choose to applay a photo effect, after capturing the image

Declared In

UIViewController+SCCustomViewController.h

captureImageFromCameraWithQuality:andCompleteAction:

Captures an Image from Camera for submission using UIImagePickerController.

- (void)captureImageFromCameraWithQuality:(id)quality andCompleteAction:(id)completion

Parameters

quality
  • The requested Image Quality to capture the image.
completion
  • Completion Handler, will be called with the Rich Media Key of the image when done

Declared In

UIViewController+SCCustomViewController.h

captureImageFromCameraWithQuality:andCompleteAction:usingPhotoEffects:

Captures an Image from Camera for submission using UIImagePickerController.

- (void)captureImageFromCameraWithQuality:(id)quality andCompleteAction:(id)completion usingPhotoEffects:(id)useEffects

Parameters

quality
  • The requested Image Quality to capture the image.
completion
  • Completion Handler, will be called with the Rich Media Key of the image when done
useEffects
  • Choose to applay a photo effect, after capturing the image

Declared In

UIViewController+SCCustomViewController.h

captureMediaFromImagePicker:andCompleteAction:

Captures an Image or Video from UIImagePickerController.

- (void)captureMediaFromImagePicker:(id)imagePicker andCompleteAction:(id)completion

Parameters

imagePicker
  • The imagePicker to capture from
completion
  • Completion Handler, will be called with the Rich Media Key of the video or image when done

Discussion

This method gets you full control on the ImagePicker setup.

Declared In

UIViewController+SCCustomViewController.h

captureMediaFromImagePicker:andCompleteAction:usingPhotoEffects:

Captures an Image or Video from UIImagePickerController.

- (void)captureMediaFromImagePicker:(id)imagePicker andCompleteAction:(id)completion usingPhotoEffects:(id)useEffects

Parameters

imagePicker
  • The imagePicker to capture from
completion
  • Completion Handler, will be called with the Rich Media Key of the video or image when done
useEffects
  • Choose to applay a photo effect, after capturing the image

Discussion

This method gets you full control on the ImagePicker setup.

Declared In

UIViewController+SCCustomViewController.h

captureVideoFromAlbumWithQuality:andCompleteAction:

Captures a Video from Album for submission using UIImagePickerController.

- (void)captureVideoFromAlbumWithQuality:(id)quality andCompleteAction:(id)completion

Parameters

quality
  • The requested Video Quality. If the original video has a higher resolution, it will be scaled down automatically
completion
  • Completion Handler will be called with the Rich Media Key of the video when done

Declared In

UIViewController+SCCustomViewController.h

captureVideoFromCameraWithQuality:andCompleteAction:

Captures a Video from Camera for submission using UIImagePickerController.

- (void)captureVideoFromCameraWithQuality:(id)quality andCompleteAction:(id)completion

Parameters

quality
  • The requested Video Quality to record the video.
completion
  • Completion Handler, will be called with the Rich Media Key of the video when done

Declared In

UIViewController+SCCustomViewController.h

closeViewControllerWithAnimation:

- (IBAction)closeViewControllerWithAnimation:(id)sender

closeViewControllerWithoutAnimation:

- (IBAction)closeViewControllerWithoutAnimation:(id)sender

composeMessage:richMessageKey:

Presents the standard SCComposeMessageController.

- (void)composeMessage:(id)messageOrNil richMessageKey:(id)keyOrNil

Parameters

messageOrNil
  • Preset the message text (optional)
keyOrNil
  • Preset the Rich Media Content item (optional)

Declared In

UIViewController+SCCustomViewController.h

composeMessage:richMessageKey:answerLastContact:

Presents the standard SCComposeMessageController with the last communication contact pre-selected as target.

- (void)composeMessage:(id)messageOrNil richMessageKey:(id)keyOrNil answerLastContact:(id)answer

Parameters

messageOrNil
  • Preset the message text (optional)
keyOrNil
  • Preset the Rich Media Content item (optional)
answer
  • YES - Use the last contact as pre-selected receiver / NO - Shows the receiver selection first

Declared In

UIViewController+SCCustomViewController.h

customPrepareForSegue:sender:

Handels the parameter setup for SDK GUI Components connected via UIStoryboardSegue.

Please see the above description.
- (void)customPrepareForSegue:(id)segue sender:(id)sender

Parameters

segue
  • The StoryboardSegue
sender
  • The sender

Declared In

UIViewController+SCCustomViewController.h

findFirstResponder:

- (UIView *)findFirstResponder:(id)startView

hasLeftBarButtonStack

- (BOOL)hasLeftBarButtonStack

hasRightBarButtonStack

- (BOOL)hasRightBarButtonStack

instantiateViewControllerForName:

Instantiates a C2Call SDK GUI Component.

- (UIViewController *)instantiateViewControllerForName:(id)vcname

Parameters

vcname
  • Storyboard Name of the ViewController

Discussion

The C2Call SDK provides various standard components for all its communication features. These components may be used as is or can be modified by the application developer. To do so, copy the GUI Component from the SCStoryboard, to the application MainStoryboard and modify it.

instantiateViewControllerWithIdentifier first seeks the component in the MainStoryboard and then in the SCStoryboard to instantiate the component. This ensures that that the developer version takes precedence over the standard version.

Declared In

UIViewController+SCCustomViewController.h

openBrowserWithUrl:andTitle:

Presents a Browser View with URL and Title using SCBrowserViewController.

- (void)openBrowserWithUrl:(id)url andTitle:(id)browserTitle

Parameters

url
  • URL to present
browserTitle
  • Title of the Browser View

Declared In

UIViewController+SCCustomViewController.h

popLeftBarButtonItem

- (void)popLeftBarButtonItem

popRightBarButtonItem

- (void)popRightBarButtonItem

pushLeftBarButtonItem:

- (void)pushLeftBarButtonItem:(id)barButton

pushRightBarButtonItem:

- (void)pushRightBarButtonItem:(id)barButton

recordVoiceMail:

Records a VoiceMail for submission using SCAudioRecorderController.

- (void)recordVoiceMail:(id)completion

Parameters

completion
  • Completion Handler, will be called with the Rich Media Key of the recorded voicemail when done

Declared In

UIViewController+SCCustomViewController.h

requestLocation:

Picks a Location or nearby Google Places for submission using SCLocationSubmitController.

- (void)requestLocation:(id)completion

Parameters

completion
  • Completion Handler, will be called with the Rich Media Key of the location or place when done

Declared In

UIViewController+SCCustomViewController.h

showChatForUserid:

Presents a Chat History using the SCChatController component.

- (void)showChatForUserid:(id)userid

Parameters

userid
  • Userid of a Friend

Declared In

UIViewController+SCCustomViewController.h

showChatForUserid:startEdit:

Presents a Chat History using the SCChatController component.

- (void)showChatForUserid:(id)userid startEdit:(id)startEdit

Parameters

userid
  • Userid of a Friend
startEdit
  • YES - Set the firstResponder to the Chat input to start edit

Declared In

UIViewController+SCCustomViewController.h

showContact:

Presents a VCard using the SCPersonController component.

- (void)showContact:(id)vcard

Parameters

vcard
  • Rich Media Key of a VCARD

Declared In

UIViewController+SCCustomViewController.h

showCountrySelectionWithDelegate:

Present a Country Selection Controller for choosing country codes

- (void)showCountrySelectionWithDelegate:(id)delegate

Parameters

delegate

Declared In

UIViewController+SCCustomViewController.h

showDocument:

Presents a Document Preview using the SCDocumentViewerController component.

- (void)showDocument:(id)documentKey

Parameters

documentKey
  • Rich Media Key of a Document

Declared In

UIViewController+SCCustomViewController.h

showFriendDetailForUserid:

Presents Friend Details using the SCFriendDetailController component.

- (void)showFriendDetailForUserid:(id)userid

Parameters

userid
  • Userid of a Friend

Declared In

UIViewController+SCCustomViewController.h

showGroupChatForUserid:

Presents a Chat History using the SCGroupChatController component.

- (void)showGroupChatForUserid:(id)userid

Parameters

userid
  • Userid of a Friend

Discussion

The group chat controller component shows the actual sender name on a message

Declared In

UIViewController+SCCustomViewController.h

showGroupChatForUserid:startEdit:

Presents a Chat History using the SCGroupChatController component.

- (void)showGroupChatForUserid:(id)userid startEdit:(id)startEdit

Parameters

userid
  • Userid of a Friend
startEdit
  • YES - Set the firstResponder to the Chat input to start edit

Discussion

The group chat controller component shows the actual sender name on a message

Declared In

UIViewController+SCCustomViewController.h

showGroupDetailForGroupid:

Presents Group Details using the SCGroupDetailController component.

- (void)showGroupDetailForGroupid:(id)groupid

Parameters

groupid
  • Userid of a Group

Declared In

UIViewController+SCCustomViewController.h

showLocation:forUser:

Presents a location using the SCLocationViewerController component.

- (void)showLocation:(id)locationKey forUser:(id)user

Parameters

locationKey
  • Rich Media Key of a location
user
  • Name of the user in that location

Declared In

UIViewController+SCCustomViewController.h

showPhoto:

Presents a photo using the SCPhotoViewerController component.

- (void)showPhoto:(id)imageKey

Parameters

imageKey
  • Rich Media Key of an image

Declared In

UIViewController+SCCustomViewController.h

showPhotos:currentPhoto:

Presents a list of photos using the SCPhotoViewerController component.

- (void)showPhotos:(id)imageList currentPhoto:(id)imageKey

Parameters

imageList
  • List of Rich Media Image keys
imageKey
  • Rich Media Key of first image to present

Declared In

UIViewController+SCCustomViewController.h

showUserImageForUserid:

Presents the User Image as large image using the SCUserImageController component.

- (void)showUserImageForUserid:(id)userid

Parameters

userid
  • Userid of a Friend

Declared In

UIViewController+SCCustomViewController.h

showVideo:

Presents a video using the SCVideoPlayerController component.

- (void)showVideo:(id)videoKey

Parameters

videoKey
  • Rich Media Key of a video

Declared In

UIViewController+SCCustomViewController.h

showVoiceMail:

Presents a VoiceMail using the SCAudioPlayerController component.

- (void)showVoiceMail:(id)voiceMailKey

Parameters

voiceMailKey
  • Rich Media Key of a VoiceMail

Declared In

UIViewController+SCCustomViewController.h