测试网络,修改UI

This commit is contained in:
2025-10-30 13:10:33 +08:00
parent 8ce1d95c8c
commit 9b43274e93
6 changed files with 21 additions and 10 deletions

View File

@@ -26,6 +26,8 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
_enabled = NO; //
_timeout = 10.0;
_defaultHeaders = @{ @"Accept": @"application/json" };
//
_baseURL = [NSURL URLWithString:KB_BASE_URL];
}
return self;
}

View File

@@ -17,5 +17,8 @@
#import "Masonry.h"
// 网络基地址Mock环境
#define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/"
#endif /* PrefixHeader_pch */

View File

@@ -20,6 +20,8 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoard.CustomKeyb
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self setupRootVC];
// 访
[KBNetworkManager shared].enabled = YES;
///
[self getNetJudge];
/// Bugly

View File

@@ -9,6 +9,7 @@
#import "KBGuideVC.h"
@interface HomeVC ()
@property (nonatomic, strong) UITextView *textView;
@end
@@ -17,17 +18,15 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
// Simple demo content so the tab is distinguishable
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
label.text = @"Home";
label.textColor = [UIColor darkTextColor];
label.font = [UIFont systemFontOfSize:20 weight:UIFontWeightSemibold];
[label sizeToFit];
label.center = self.view.center;
label.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[self.view addSubview:label];
CGRect frame = CGRectMake(([UIScreen mainScreen].bounds.size.width - 200)/2, 150, 200, 200);
self.textView = [[UITextView alloc] initWithFrame:frame];
self.textView.text = @"测试";
self.textView.layer.borderColor = [UIColor blackColor].CGColor;
self.textView.layer.borderWidth = 0.5;
[self.view addSubview:self.textView];
[self.textView becomeFirstResponder];
[[KBNetworkManager shared] GET:@"https://m1.apifoxmock.com/m1/5438099-5113192-default/app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[[KBNetworkManager shared] GET:@"app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"====");
}];
}

View File

@@ -26,6 +26,8 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
_enabled = NO; //
_timeout = 10.0;
_defaultHeaders = @{ @"Accept": @"application/json" };
//
_baseURL = [NSURL URLWithString:KB_BASE_URL];
}
return self;
}

View File

@@ -29,6 +29,9 @@
//-----------------------------------------------宏定义全局----------------------------------------------------------/
// 网络基地址Mock环境
#define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/"
/// UI 尺寸/设备宏
// 屏幕尺寸
#define KB_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)