|
@@ -7,20 +7,21 @@
|
|
|
//
|
|
//
|
|
|
|
|
|
|
|
#import "DefaultAppearance.h"
|
|
#import "DefaultAppearance.h"
|
|
|
-#import "LoginViewController.h"
|
|
|
|
|
-#import "CategoryCellNPD.h"
|
|
|
|
|
-#import "CategoryHeaderView.h"
|
|
|
|
|
-#import "DefaultTableHeaderView.h"
|
|
|
|
|
-#import "CategoryCellSmall.H"
|
|
|
|
|
-#import "ModelItemCell.h"
|
|
|
|
|
-#import "PDFListTableViewCell.h"
|
|
|
|
|
-#import "ContactListTableViewCell.h"
|
|
|
|
|
-#import "CategoryCellNPD.h"
|
|
|
|
|
-#import "CommonEditorCellMAction.h"
|
|
|
|
|
-#import "DefaultImageButton.h"
|
|
|
|
|
-#import "OrderListTableViewCell.h"
|
|
|
|
|
-#import "CommonEditorCellModel.h"
|
|
|
|
|
-#import "BundleDetailButton.h"
|
|
|
|
|
|
|
+#import "const.h"
|
|
|
|
|
+//#import "LoginViewController.h"
|
|
|
|
|
+//#import "CategoryCellNPD.h"
|
|
|
|
|
+//#import "CategoryHeaderView.h"
|
|
|
|
|
+//#import "DefaultTableHeaderView.h"
|
|
|
|
|
+//#import "CategoryCellSmall.H"
|
|
|
|
|
+//#import "ModelItemCell.h"
|
|
|
|
|
+//#import "PDFListTableViewCell.h"
|
|
|
|
|
+//#import "ContactListTableViewCell.h"
|
|
|
|
|
+//#import "CategoryCellNPD.h"
|
|
|
|
|
+//#import "CommonEditorCellMAction.h"
|
|
|
|
|
+//#import "DefaultImageButton.h"
|
|
|
|
|
+//#import "OrderListTableViewCell.h"
|
|
|
|
|
+//#import "CommonEditorCellModel.h"
|
|
|
|
|
+//#import "BundleDetailButton.h"
|
|
|
|
|
|
|
|
@implementation DefaultAppearance
|
|
@implementation DefaultAppearance
|
|
|
+(void)init_appearance
|
|
+(void)init_appearance
|
|
@@ -98,130 +99,151 @@
|
|
|
+(id) get_appearance:(NSString*) control container:(NSDictionary*)container_json
|
|
+(id) get_appearance:(NSString*) control container:(NSDictionary*)container_json
|
|
|
{
|
|
{
|
|
|
// json 中添加 control 类型必须在此函数中添加对应代码
|
|
// json 中添加 control 类型必须在此函数中添加对应代码
|
|
|
- if([control isEqualToString:@"UIButton"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UIButton appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UIButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if([control isEqualToString:@"UISegmentedControl"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UISegmentedControl appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UISegmentedControl appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- else if([control isEqualToString:@"BundleDetailButton"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [BundleDetailButton appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [BundleDetailButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- else if([control isEqualToString:@"UISearchBar"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UISearchBar appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UISearchBar appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"DefaultImageButton"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [DefaultImageButton appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [DefaultImageButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Class class_control =NSClassFromString(control);
|
|
|
|
|
+ if(class_control==nil)
|
|
|
|
|
+ return nil;
|
|
|
|
|
|
|
|
- else if([control isEqualToString:@"UIActivityIndicatorView"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UIActivityIndicatorView appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UIActivityIndicatorView appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"CategoryCellNPD"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [CategoryCellNPD appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [CategoryCellNPD appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"UILabel"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UILabel appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UILabel appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"DefaultTableHeaderView"])
|
|
|
|
|
|
|
+ if(container_json==nil)
|
|
|
|
|
+ return [class_control appearance];
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [DefaultTableHeaderView appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [DefaultTableHeaderView appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"CategoryCellSmall"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [CategoryCellSmall appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [CategoryCellSmall appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"UIBarButtonItem"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UIBarButtonItem appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UIBarButtonItem appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else if([control isEqualToString:@"UINavigationBar"])
|
|
|
|
|
- {
|
|
|
|
|
- if(container_json==nil)
|
|
|
|
|
- return [UINavigationBar appearance];
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
- return [UINavigationBar appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+ if(arr_container.count==0)
|
|
|
|
|
+ return nil;
|
|
|
|
|
+ return [class_control appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
}
|
|
}
|
|
|
- return nil;
|
|
|
|
|
|
|
+
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// if([control isEqualToString:@"UIButton"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UIButton appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+//
|
|
|
|
|
+// return [UIButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// if([control isEqualToString:@"UISegmentedControl"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UISegmentedControl appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UISegmentedControl appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// else if([control isEqualToString:@"BundleDetailButton"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [BundleDetailButton appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [BundleDetailButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// else if([control isEqualToString:@"UISearchBar"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UISearchBar appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UISearchBar appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"DefaultImageButton"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [DefaultImageButton appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [DefaultImageButton appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// else if([control isEqualToString:@"UIActivityIndicatorView"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UIActivityIndicatorView appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UIActivityIndicatorView appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"CategoryCellNPD"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [CategoryCellNPD appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [CategoryCellNPD appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"UILabel"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UILabel appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UILabel appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"DefaultTableHeaderView"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [DefaultTableHeaderView appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [DefaultTableHeaderView appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"CategoryCellSmall"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [CategoryCellSmall appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [CategoryCellSmall appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"UIBarButtonItem"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UIBarButtonItem appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UIBarButtonItem appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([control isEqualToString:@"UINavigationBar"])
|
|
|
|
|
+// {
|
|
|
|
|
+// if(container_json==nil)
|
|
|
|
|
+// return [UINavigationBar appearance];
|
|
|
|
|
+// else
|
|
|
|
|
+// {
|
|
|
|
|
+// NSArray* arr_container = [self appearance_container:container_json];
|
|
|
|
|
+// return [UINavigationBar appearanceWhenContainedIn: arr_container[0], nil];
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return nil;
|
|
|
}
|
|
}
|
|
|
+(void) set_appearance_item:(NSDictionary*) item_json
|
|
+(void) set_appearance_item:(NSDictionary*) item_json
|
|
|
{
|
|
{
|
|
@@ -324,56 +346,65 @@
|
|
|
{
|
|
{
|
|
|
NSString * item = [NSString stringWithFormat:@"item_%d",i];
|
|
NSString * item = [NSString stringWithFormat:@"item_%d",i];
|
|
|
NSString* container = container_json[item];
|
|
NSString* container = container_json[item];
|
|
|
- if([container isEqualToString:@"CategoryHeaderView"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[CategoryHeaderView class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"CommonEditorCellModel"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[CommonEditorCellModel class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"OrderListTableViewCell"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[OrderListTableViewCell class]];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- else if([container isEqualToString:@"CommonEditorCellMAction"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[CommonEditorCellMAction class]];
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- else if([container isEqualToString:@"DefaultTableHeaderView"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[DefaultTableHeaderView class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"UINavigationBar"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[UINavigationBar class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"UINavigationItem"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[UINavigationItem class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"ModelItemCell"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[ModelItemCell class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"PDFListTableViewCell"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[PDFListTableViewCell class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"UIToolbar"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[UIToolbar class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"ContactListTableViewCell"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[ContactListTableViewCell class]];
|
|
|
|
|
- }
|
|
|
|
|
- else if([container isEqualToString:@"CategoryCellNPD"])
|
|
|
|
|
- {
|
|
|
|
|
- [arr addObject:[CategoryCellNPD class]];
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Class class_container =NSClassFromString(container);
|
|
|
|
|
+ if(class_container==nil)
|
|
|
|
|
+ continue;
|
|
|
|
|
+ [arr addObject:class_container];
|
|
|
|
|
+// if([container isEqualToString:@"CategoryHeaderView"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[CategoryHeaderView class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"UITableView"])
|
|
|
|
|
+// {
|
|
|
|
|
+//// NSClassFromString(@"UISwipeActionPullView")
|
|
|
|
|
+// [arr addObject:NSClassFromString(@"UISwipeActionPullView")];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"CommonEditorCellModel"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[CommonEditorCellModel class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"OrderListTableViewCell"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[OrderListTableViewCell class]];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// else if([container isEqualToString:@"CommonEditorCellMAction"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[CommonEditorCellMAction class]];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// else if([container isEqualToString:@"DefaultTableHeaderView"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[DefaultTableHeaderView class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"UINavigationBar"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[UINavigationBar class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"UINavigationItem"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[UINavigationItem class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"ModelItemCell"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[ModelItemCell class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"PDFListTableViewCell"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[PDFListTableViewCell class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"UIToolbar"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[UIToolbar class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"ContactListTableViewCell"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[ContactListTableViewCell class]];
|
|
|
|
|
+// }
|
|
|
|
|
+// else if([container isEqualToString:@"CategoryCellNPD"])
|
|
|
|
|
+// {
|
|
|
|
|
+// [arr addObject:[CategoryCellNPD class]];
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|