Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
30554D26163255070069220E /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 30554D25163255070069220E /* [email protected] */; };
30B35CF517E54C820082CE0E /* RECommonFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B35CF417E54C820082CE0E /* RECommonFunctions.m */; };
30FD6D641631F8550017516D /* REComposeViewController.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 30FD6D631631F8550017516D /* REComposeViewController.bundle */; };
35F504ED19D1AEAB00A295DC /* ModalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 35F504EC19D1AEAB00A295DC /* ModalViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -63,6 +64,8 @@
30B35CF317E54C820082CE0E /* RECommonFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RECommonFunctions.h; sourceTree = "<group>"; };
30B35CF417E54C820082CE0E /* RECommonFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RECommonFunctions.m; sourceTree = "<group>"; };
30FD6D631631F8550017516D /* REComposeViewController.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = REComposeViewController.bundle; sourceTree = "<group>"; };
35F504EB19D1AEAB00A295DC /* ModalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModalViewController.h; sourceTree = "<group>"; };
35F504EC19D1AEAB00A295DC /* ModalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModalViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -117,6 +120,8 @@
30118CEC1631D1D200B82F14 /* RootViewController.h */,
30118CED1631D1D200B82F14 /* RootViewController.m */,
30118CD21631D0DD00B82F14 /* Supporting Files */,
35F504EB19D1AEAB00A295DC /* ModalViewController.h */,
35F504EC19D1AEAB00A295DC /* ModalViewController.m */,
);
path = REComposeViewControllerExample;
sourceTree = "<group>";
Expand Down Expand Up @@ -230,6 +235,7 @@
files = (
30118CD81631D0DD00B82F14 /* main.m in Sources */,
30B35CF517E54C820082CE0E /* RECommonFunctions.m in Sources */,
35F504ED19D1AEAB00A295DC /* ModalViewController.m in Sources */,
30118CDC1631D0DD00B82F14 /* AppDelegate.m in Sources */,
30118CEB1631D18A00B82F14 /* REComposeViewController.m in Sources */,
30118CEE1631D1D200B82F14 /* RootViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// ModalViewController.h
// REComposeViewControllerExample
//
// Created by Antol Peshkov on 23.09.14.
// Copyright (c) 2014 Roman Efimov. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ModalViewController : UIViewController

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
// ModalViewController.m
// REComposeViewControllerExample
//
// Created by Antol Peshkov on 23.09.14.
// Copyright (c) 2014 Roman Efimov. All rights reserved.
//

#import "ModalViewController.h"
#import "REComposeViewController.h"

@interface ModalViewController () <REComposeViewControllerDelegate>

@end

@implementation ModalViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor lightGrayColor];

UIButton *socialExampleButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
socialExampleButton.frame = CGRectMake((self.view.frame.size.width - 200) / 2.0f, 140, 200, 40);
socialExampleButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[socialExampleButton addTarget:self action:@selector(socialExampleButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[socialExampleButton setTitle:@"Some social network" forState:UIControlStateNormal];
[self.view addSubview:socialExampleButton];

UIButton *backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
backButton.frame = CGRectMake((self.view.frame.size.width - 200) / 2.0f, 170, 200, 40);
backButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[backButton addTarget:self action:@selector(backButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:@"< Back" forState:UIControlStateNormal];
[self.view addSubview:backButton];
}

- (void)socialExampleButtonPressed
{
REComposeViewController *composeViewController = [[REComposeViewController alloc] init];
composeViewController.title = @"Social Network";
composeViewController.hasAttachment = YES;
composeViewController.delegate = self;
composeViewController.text = @"Test";
[composeViewController presentFromRootViewController];
}

- (void)backButtonPressed
{
[self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark -
#pragma mark REComposeViewControllerDelegate

- (void)composeViewController:(REComposeViewController *)composeViewController didFinishWithResult:(REComposeResult)result
{
[composeViewController dismissViewControllerAnimated:YES completion:nil];

if (result == REComposeResultCancelled) {
NSLog(@"Cancelled");
}

if (result == REComposeResultPosted) {
NSLog(@"Text: %@", composeViewController.text);
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "RootViewController.h"
#import "REComposeViewController.h"
#import "ModalViewController.h"

@interface RootViewController ()

Expand Down Expand Up @@ -47,6 +48,13 @@ - (void)viewDidLoad
[foursquareExampleButton addTarget:self action:@selector(foursquareExampleButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[foursquareExampleButton setTitle:@"Foursquare" forState:UIControlStateNormal];
[self.view addSubview:foursquareExampleButton];

UIButton *presentedVCExampleButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
presentedVCExampleButton.frame = CGRectMake((self.view.frame.size.width - 200) / 2.0f, 170, 200, 40);
presentedVCExampleButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[presentedVCExampleButton addTarget:self action:@selector(presentVCButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[presentedVCExampleButton setTitle:@"Presented ViewController" forState:UIControlStateNormal];
[self.view addSubview:presentedVCExampleButton];
}

#pragma mark -
Expand Down Expand Up @@ -108,6 +116,11 @@ - (void)foursquareExampleButtonPressed
[composeViewController presentFromRootViewController];
}

- (void)presentVCButtonPressed
{
[self presentViewController:[ModalViewController new] animated:YES completion:nil];
}

#pragma mark -
#pragma mark Orientation

Expand Down