//
//  AppDelegate.m
//  SLAiELTS
//
//  Created by Gusont on 2023/2/27.
//

#import "AppDelegate.h"
#import "IQKeyboardManager.h"
#import "SLLoginVCViewController.h"
#import "SLBaseTabBarController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [SLHttpCenter SharedInstance].serverUrl = @"http://dlchat.zheke.com";
//    [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
//    SLBaseTabBarController *baseVc = [[SLBaseTabBarController alloc] init];
    UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];
    [self.window makeKeyAndVisible];
    [self buildIQkeyBoard];
    return YES;
}

- (void)setTabWithRootWindow {
    SLBaseTabBarController *tabBarContr = [[SLBaseTabBarController alloc] init];
    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:tabBarContr];;
    [self.window makeKeyAndVisible];
}

- (void)setLoginVcWithRootWindow {
    UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
    self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];;
    [self.window makeKeyAndVisible];
}



#pragma MARK- IQ键盘初始化
-(void)buildIQkeyBoard
{
    IQKeyboardManager *manager =  [IQKeyboardManager sharedManager];
    manager.enable = YES;//是否启用键盘管理
    manager.shouldResignOnTouchOutside = YES;//点击可编辑之外，是否自动隐藏键盘
    manager.enableAutoToolbar = NO;//控制是否显示键盘上的工具条
    manager.keyboardDistanceFromTextField = 20.f;
    manager.layoutIfNeededOnUpdate = YES;
}

@end
