|
| 1 | +// |
| 2 | +// AppDelegate.m |
| 3 | +// |
| 4 | +// Copyright (c) 2019 Taner Sener |
| 5 | +// |
| 6 | +// This file is part of MobileFFmpeg. |
| 7 | +// |
| 8 | +// MobileFFmpeg is free software: you can redistribute it and/or modify |
| 9 | +// it under the terms of the GNU Lesser General Public License as published by |
| 10 | +// the Free Software Foundation, either version 3 of the License, or |
| 11 | +// (at your option) any later version. |
| 12 | +// |
| 13 | +// MobileFFmpeg is distributed in the hope that it will be useful, |
| 14 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +// GNU Lesser General Public License for more details. |
| 17 | +// |
| 18 | +// You should have received a copy of the GNU Lesser General Public License |
| 19 | +// along with MobileFFmpeg. If not, see <http://www.gnu.org/licenses/>. |
| 20 | +// |
| 21 | + |
| 22 | +#import <mobileffmpeg/MobileFFmpegConfig.h> |
| 23 | +#import "AppDelegate.h" |
| 24 | + |
| 25 | +void uncaughtExceptionHandler(NSException *exception) { |
| 26 | + NSLog(@"Uncaught exception detected: %@.", exception); |
| 27 | + NSLog(@"%@", [exception callStackSymbols]); |
| 28 | +} |
| 29 | + |
| 30 | +@interface AppDelegate () |
| 31 | + |
| 32 | +@end |
| 33 | + |
| 34 | +@implementation AppDelegate |
| 35 | + |
| 36 | + |
| 37 | +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { |
| 38 | + // Override point for customization after application launch. |
| 39 | + |
| 40 | + NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler); |
| 41 | + |
| 42 | + // UPDATE TAB BAR STYLE |
| 43 | + UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController; |
| 44 | + UITabBar *tabBar = tabBarController.tabBar; |
| 45 | + UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0]; |
| 46 | + UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1]; |
| 47 | + UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2]; |
| 48 | + UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3]; |
| 49 | + UITabBarItem *tabBarItem5 = [tabBar.items objectAtIndex:4]; |
| 50 | + UITabBarItem *tabBarItem6 = [tabBar.items objectAtIndex:5]; |
| 51 | + UITabBarItem *tabBarItem7 = [tabBar.items objectAtIndex:6]; |
| 52 | + tabBarItem1.title = @"COMMAND"; |
| 53 | + tabBarItem2.title = @"VIDEO"; |
| 54 | + tabBarItem3.title = @"HTTPS"; |
| 55 | + tabBarItem4.title = @"AUDIO"; |
| 56 | + tabBarItem5.title = @"SUBTITLE"; |
| 57 | + tabBarItem6.title = @"VID.STAB"; |
| 58 | + tabBarItem7.title = @"PIPE"; |
| 59 | + |
| 60 | + // SELECTED BAR ITEM |
| 61 | + [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: |
| 62 | + [UIColor whiteColor], NSForegroundColorAttributeName, |
| 63 | + [UIFont systemFontOfSize:38], NSFontAttributeName, |
| 64 | + nil] forState:UIControlStateSelected]; |
| 65 | + |
| 66 | + // NOT SELECTED BAR ITEMS |
| 67 | + [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: |
| 68 | + [UIColor darkGrayColor], NSForegroundColorAttributeName, |
| 69 | + [UIFont systemFontOfSize:38], NSFontAttributeName, |
| 70 | + nil] forState:UIControlStateNormal]; |
| 71 | + |
| 72 | + NSString *resourceFolder = [[NSBundle mainBundle] resourcePath]; |
| 73 | + NSDictionary *fontNameMapping = @{@"MyFontName" : @"Doppio One"}; |
| 74 | + |
| 75 | + [MobileFFmpegConfig setFontDirectory:resourceFolder with:fontNameMapping]; |
| 76 | + [MobileFFmpegConfig setFontDirectory:resourceFolder with:nil]; |
| 77 | + |
| 78 | + return YES; |
| 79 | +} |
| 80 | + |
| 81 | + |
| 82 | +- (void)applicationWillResignActive:(UIApplication *)application { |
| 83 | + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. |
| 84 | + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. |
| 85 | +} |
| 86 | + |
| 87 | + |
| 88 | +- (void)applicationDidEnterBackground:(UIApplication *)application { |
| 89 | + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. |
| 90 | + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. |
| 91 | +} |
| 92 | + |
| 93 | + |
| 94 | +- (void)applicationWillEnterForeground:(UIApplication *)application { |
| 95 | + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. |
| 96 | +} |
| 97 | + |
| 98 | + |
| 99 | +- (void)applicationDidBecomeActive:(UIApplication *)application { |
| 100 | + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. |
| 101 | +} |
| 102 | + |
| 103 | + |
| 104 | +- (void)applicationWillTerminate:(UIApplication *)application { |
| 105 | + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. |
| 106 | +} |
| 107 | + |
| 108 | + |
| 109 | +@end |
0 commit comments