Merge branch 'master' of ssh://github.com/kivy/kivy-ios
This commit is contained in:
commit
b0a2bb2178
1 changed files with 10 additions and 11 deletions
|
@ -13,15 +13,15 @@
|
||||||
/* guess the view controller from our SDL window.
|
/* guess the view controller from our SDL window.
|
||||||
*/
|
*/
|
||||||
UIViewController *get_viewcontroller(void) {
|
UIViewController *get_viewcontroller(void) {
|
||||||
NSArray *windows = [[UIApplication sharedApplication] windows];
|
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
|
||||||
if ( windows == NULL ) {
|
if ( window == NULL ) {
|
||||||
printf("ios_wrapper: unable to get windows from shared application\n");
|
printf("ios_wrapper: unable to get key window from shared application\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
UIWindow *uiWindow = [windows objectAtIndex:0];
|
// return window.rootViewController;
|
||||||
UIView* view = [uiWindow.subviews objectAtIndex:0];
|
UIView* view = [window.subviews objectAtIndex:0];
|
||||||
id nextResponder = [view nextResponder];
|
id nextResponder = [view nextResponder];
|
||||||
if( [nextResponder isKindOfClass:[UIViewController class]] )
|
if( [nextResponder isKindOfClass:[UIViewController class]] )
|
||||||
return (UIViewController *)nextResponder;
|
return (UIViewController *)nextResponder;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ UIViewController *get_viewcontroller(void) {
|
||||||
@synthesize callback;
|
@synthesize callback;
|
||||||
|
|
||||||
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
|
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
|
||||||
UIViewController* viewController = get_viewcontroller();
|
|
||||||
static char *statuses[] = {"unknown", "cancelled", "saved", "sent", "failed"};
|
static char *statuses[] = {"unknown", "cancelled", "saved", "sent", "failed"};
|
||||||
|
|
||||||
if ( callback != NULL ) {
|
if ( callback != NULL ) {
|
||||||
|
@ -58,8 +57,8 @@ UIViewController *get_viewcontroller(void) {
|
||||||
callback(status, userdata);
|
callback(status, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
[viewController becomeFirstResponder];
|
UIViewController* viewController = [controller presentingViewController];
|
||||||
[viewController dismissModalViewControllerAnimated:NO];
|
[viewController dismissModalViewControllerAnimated:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -103,7 +102,7 @@ int ios_send_email(char *subject, char *text, char *mimetype, char *filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.modalPresentationStyle = UIModalPresentationPageSheet;
|
controller.modalPresentationStyle = UIModalPresentationPageSheet;
|
||||||
[viewController presentModalViewController:controller animated:NO];
|
[viewController presentModalViewController:controller animated:YES];
|
||||||
[controller release];
|
[controller release];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue