<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: mail - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/mail</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 03:43:30 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/mail/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>gaminghorror on "I&#039;m sharing some of my source code ..."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4475#post-26641</link>
			<pubDate>Sun, 14 Feb 2010 15:40:44 +0000</pubDate>
			<dc:creator>gaminghorror</dc:creator>
			<guid isPermaLink="false">26641@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>... and to be fair: a lot of this code was originally created by others and i've only taken on the job to modify it, improve it, fix it. I give credit wherever possibly, if you think i missed to mention someone please let me know. Some of the code was found here, most was spread over the Internet. It took me time to collect and find the code and in some cases (eg In-App Mail) i put a lot of work into getting it right as well. I hope it'll be useful to many cocos2d developers.</p>
<p>I also put up some useful links and will continue to add to this cocos2d iPhone resources page of mine as i learn more. At the time of this writing i'm sharing these classes/methods:</p>
<p>AlertPrompt, CocoaHelper, LayoutHelper, LocaleHelper, MenuGrid, PlayMusicAction, Screenshot, SendMail, ShakeHelper, Utilities</p>
<p>Read the webpage above to learn more about them. Get the source code here:<br />
<a href="http://www.gaminghorror.net/cocos2d-iphone-resources/" rel="nofollow">http://www.gaminghorror.net/cocos2d-iphone-resources/</a>
</p></description>
		</item>
		<item>
			<title>cocosGame on "send email from my game"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/21934#post-121904</link>
			<pubDate>Tue, 18 Oct 2011 16:38:57 +0000</pubDate>
			<dc:creator>cocosGame</dc:creator>
			<guid isPermaLink="false">121904@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all..<br />
i need way to let my game send email<br />
i used MFMailComposeController<br />
BUT it need view controller to display and dismiss and i do not have one !!</p>
<p>how can i built this in my game ??</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>Jonathan on "Sending an email in game with MessageUI"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3887#post-23263</link>
			<pubDate>Thu, 14 Jan 2010 12:19:39 +0000</pubDate>
			<dc:creator>Jonathan</dc:creator>
			<guid isPermaLink="false">23263@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello everybody,</p>
<p>I have been looking into sending in app emails and thought I should write a summary of what I have found and ask for help with the last point I have not resolved.</p>
<p>Well first of all MessageUI.framework needs to be added to your project.</p>
<p>I have decided to display the email page in dedicated scene that is loaded from the menu with simply replacing the scene with the director.</p>
<p>EmailScene.h :<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;UIKit/UIKit.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;MessageUI/MessageUI.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;MessageUI/MFMailComposeViewController.h&#62;

@interface EmailScene : Scene &#60;MFMailComposeViewControllerDelegate&#62;
{
	IBOutlet UILabel *message;
	MFMailComposeViewController *picker;
}

@property (nonatomic, retain) IBOutlet UILabel *message;
-(void)displayComposerSheet;
@end</code></pre>
<p>EmailScene.m :<br />
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;EmailScene.h&#34;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;MenuScene.h&#34;

@implementation EmailScene

@synthesize message;

- (id) init {
    self = [super init];
    if (self != nil) {
	[self displayComposerSheet];
    }
    return self;
}

// Displays an email composition interface inside the application. Populates all the Mail fields.
-(void)displayComposerSheet
{
	[[Director sharedDirector] pause];

	picker = [[MFMailComposeViewController alloc] init];
	picker.mailComposeDelegate = self;

	//Fill in the email as you see fit

	//display the view
	[[[Director sharedDirector] openGLView] addSubview:picker.view];

	[picker presentModalViewController:picker animated:YES];
	[picker release];
}

// Dismisses the email composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{

	[[Director sharedDirector] resume];

	//return to previous scene
	MenuScene * menuScene = [MenuScene node];
	[[Director sharedDirector] replaceScene:menuScene];

	//dismiss view after otherwise the code is not executed
	[picker.view removeFromSuperview];
	[picker dismissModalViewControllerAnimated:YES];
}
@end</code></pre>
<p>With this code the email view is displayed and functional but when returning from it, either the view is not removed properly or the director has lost the current view in which to run.</p>
<p>The email view stays visible but the director runs the code from the menu scene (visible in the logs only).</p>
<p>I don't think I am missing much for this to work so any help would be appreciated.
</p></description>
		</item>
		<item>
			<title>KingIsulgard on "Mailing from within iPhone/iPad application with an (PDF) attachment"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/16931#post-95383</link>
			<pubDate>Wed, 25 May 2011 09:49:30 +0000</pubDate>
			<dc:creator>KingIsulgard</dc:creator>
			<guid isPermaLink="false">95383@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all, </p>
<p>I want to know how to mail a PDF file by email with my iPhone/iPad app based on a resource URL.</p>
<p>I guess it would be something like<br />
<pre><code>MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
        mailController.mailComposeDelegate = self;

        [mailController setSubject:@&#34;Subject&#34;];

        [mailController addAttachmentData:pdfData
                                 mimeType:@&#34;application/pdf&#34;
                                 fileName:@&#34;file.pdf&#34;];

        [mailController setMessageBody:@&#34;Body&#34; isHTML:NO];
        [self presentModalViewController:mailController animated:YES];
        [mailController release];</code></pre>
<p>But I don't now how to create the pdfData.
</p></description>
		</item>
		<item>
			<title>Joethemonkey101 on "Trouble with UIViewController and Integrating Mail"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/10757#post-61298</link>
			<pubDate>Sat, 30 Oct 2010 17:17:23 +0000</pubDate>
			<dc:creator>Joethemonkey101</dc:creator>
			<guid isPermaLink="false">61298@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am trying to integrate mail with my app, and I'm not sure how do that. I'm doing it through UIKit, but I'm still primarily using cocos2d. That being said, I know I should use <code>@interface ClassName : UIViewController</code> , but if I do that, my other code won't work correctly. How do I get around this?
</p></description>
		</item>
		<item>
			<title>gaminghorror on "In-App Mail view: how to open mail in landscape mode?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3977#post-23803</link>
			<pubDate>Wed, 20 Jan 2010 16:51:00 +0000</pubDate>
			<dc:creator>gaminghorror</dc:creator>
			<guid isPermaLink="false">23803@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm working on a Landscape Mode app and it also has a "send mail" option just as in "51 Japanese Characters". However, when i run the code the In-App mail view is opened in Portrait mode. The portrait mode persists even after closing In-App mail and it also can't be reset to Landscape mode via the CCDirector setOrientation method.</p>
<p>My UIViewController loads the view like this:</p>
<pre><code>-(void) loadView
{
	self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
	self.wantsFullScreenLayout = YES;

	UIView *view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
	view.autoresizingMask = UIViewAutoresizingFlexibleHeight&#124;UIViewAutoresizingFlexibleWidth;
	view.backgroundColor = [UIColor clearColor];
	view.clearsContextBeforeDrawing = NO;
	view.opaque = NO;
	//view.transform = CGAffineTransformRotate(view.transform, (float)degreesToRadians(180));
	self.view = view;
	[view release];
}</code></pre>
<p>I tried playing with view.transform as you can see but nothing changed anything.</p>
<p>Here's the method that shows the view:</p>
<pre><code>+(void) showUIViewController:(UIViewController *)controller
{
	NSAssert(viewController == nil, @&#34;CocoaHelper - a viewController is already in use!&#34;);
	if (viewController == nil)
	{
		viewController = [controller retain];

		[UIView beginAnimations:nil context:NULL];
		[UIView setAnimationDuration:1.0f];
		[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[[CCDirector sharedDirector] openGLView] cache:YES];

		switch ([[CCDirector sharedDirector] deviceOrientation])
		{
			case CCDeviceOrientationLandscapeLeft:
				[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_4)];
				controller.view.center = CGPointMake(240, 160);
				break;

			case CCDeviceOrientationLandscapeRight:
				//[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_2)];
				controller.view.center = CGPointMake(160, 240);
				break;

			case CCDeviceOrientationPortraitUpsideDown:
				//[viewController.view setTransform:CGAffineTransformMakeRotation((float)M_PI_2)];
				controller.view.center = CGPointMake(160, 240);
				break;

			case CCDeviceOrientationPortrait:
			default:
				controller.view.center = CGPointMake(160, 240);
				break;
		}

		[[[CCDirector sharedDirector] openGLView] addSubview:viewController.view];
		[[CCDirector sharedDirector] pause];

		[UIView commitAnimations];
	}
}</code></pre>
<p>Again, i thought i should modify the controller.view.transform property but nothing changed either.</p>
<p>I would prefer the In-App mail to open in landscape mode but if that's not possible, at least i want to reset the app back to Landscape mode after removing the In-App mail view.</p>
<p>Any thoughts on this? What am i missing?
</p></description>
		</item>

	</channel>
</rss>

