Skip to content

Custom iOS-style dialog boxes for posting to Facebook and Twitter.

License

Notifications You must be signed in to change notification settings

psholtz/KBComposeSocial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KBComposeSocial

KBComposeSocial provides custom iOS-style dialog boxes for posting to Facebook and Twitter.

The SDK can be configured to capture any of four different media types:

  • Text only
  • Text and an image array
  • Text and a URL array
  • Text, an image array and a URL array

A delegate protocol, with two optional callbacks, is provided:

@protocol KBComposeViewControllerDelegate 

@optional
- (void)composeViewControllerDidPressCancel:(id)sender;
- (void)composeViewControllerDidPressPost:(id)sender;

@end

Clients using the SDK should implement and use the composeViewControllerDidPressPost: API to link with the Facebook and/or Twitter Social SDK implementation of their choice.

Important Note

THIS SOFTWARE DOES NOT ACTUALLY POST TO FACEBOOK OR TWITTER!

Rather, it offers user interface controls you can use to capture text, images and urls from your users.

Clients wishing to forward collected information onto the social networks must link with the Facebook and/or Twitter Social SDK implementation of their choice in the composeViewControllerDidPressPost: API.

Example Usage

You can present a Facebook dialog box using code similar to the following:

KBComposeViewController *comp = [KBComposeViewController composeViewControllerForServiceType:KBServiceTypeFacebook];
[comp setInitialText:@"Hello, Facebook!"];
[comp setDelegate:self];
[self displayViewController:comp];

Running this code would cause the user to be presented with a dialog box similar to the following:

To respond to the input entered by the user, you would implement the composeViewControllerDidPressPost: API as follows:

- (void)composeViewControllerDidPressPost:(id)sender {
    KBComposeViewController *controller = (KBComposeViewController*)sender;
    NSLog(@"++ This is text: %@", controller.text);
    NSLog(@"++ This is image array: %@", controller.images);
    NSLog(@"++ This is url array: %@", controller.urls);
    NSLog(@"++ This is number of attachments: %d", controller.attachmentsCount);

    // TODO: Extract text, images and urls, and post to Facebook/Twitter using your SDK
}

This code will be invoked when the user presses the Post button, which is the desired behavior.

Support

KBComposeSocial is designed to run on all iOS devices (iPhone4, iPhone5 and iPad) and on all iOS versions from 4.3 and up.

KBComposeSocial is designed to be used on ARC-enabled projects.

KBComposeSocial requires linking with the QuartzCore framework.

License

This code is distributed under the terms and conditions of the MIT license.

Change Log

Version 1.1 @ February 11, 2015.

  • Support for iOS7, iOS8.
  • Other minor updates.

Version 1.0 @ January 18, 2014.

  • Initial Release.

About

Custom iOS-style dialog boxes for posting to Facebook and Twitter.

Resources

License

Stars

Watchers

Forks

Packages

No packages published