applicationwillresignactiveのタグがつけられたコード一覧

Objective-C バックグラウンドに入る時にmodalViewControllerをdismiss、ここでは(UIImagePickerController)

#import <UIKit/UIKit.h>
//hファイル
@interface PickerImageTestAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (weak, nonatomic) UIImagePickerController *picker;
@end

//mファイル
#import "PickerImageTestAppDelegate.h"

//↓ デフォルトでできるViewController
#import "PickerImageTestViewController.h"
@implementation PickerImageTestAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSLog(@"%s\n\n",__func__);
    UIStoryboard *storyBoard = [self.window.rootViewController storyboard];
    PickerImageTestViewController *myPicker = [storyBoard instantiateViewControllerWithIdentifier:@"MyPicker"];
    self.window.rootViewController = myPicker;
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    UIViewController *vc = [self.window.rootViewController presentedViewController];
    if ([vc isKindOfClass:[UIImagePickerController class]]) {
        [vc dismissModalViewControllerAnimated:NO];
    }
}

よく投稿されているコード

タグ

最近投稿されたコード