TagsTableViewController.h 文件

#import <UIKit/UIKit.h>
#import "personSearch.h" @interface TagsTableViewController : UITableViewController<UITableViewDataSource,UITableViewDelegate> @property (nonatomic,retain) personSearch *searchBar; @property (nonatomic, strong) NSString *key; @end TagsTableViewController.m 文件 #import "TagsTableViewController.h"
#import "TagsTableCell.h"
#import "SKTagView.h"
#import "SKTagButton.h"
#import "FTMacro.h"
#import "SearchResultViewController.h"
#import "DBStrore.h"
#import "Utilities.h"
//#import "guideInfoViewController.h"
//#import "reviewInfoViewController.h"
//#import "mShopInfoViewController.h"
//#import "tempModel.h"
#import "BaseSVRRequestOperator.h"
//#import "pointRuleViewController.h"
//#import "ALBBTradeObject.h"
#import "HttpConnect.h"
#import "PicViewController.h" #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
//Cell
static NSString *const kTagsTableCellReuseIdentifier = @"TagsTableCell"; @interface UIImage (SKTagView)
+ (UIImage *)imageWithColor:(UIColor *)color;
@end @interface TagsTableViewController ()<UISearchBarDelegate,SearchResultViewControllerDelegate> @property (nonatomic, strong) SearchResultViewController *searchResultView;
@property (nonatomic, strong) NSMutableArray *hotKeyArray;
@property (nonatomic, strong) NSMutableArray *historySearchArray; @property (nonatomic, strong) NSMutableArray *guideArray;
@property (nonatomic, strong) NSMutableArray *shopArray; @property (nonatomic, strong) BaseSVRRequestOperator *netWorking;
@property (strong, nonatomic) UIButton *mLookPicButton;
@end @implementation TagsTableViewController - (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"TagsTableViewController viewDidLoad ...");
self.view.backgroundColor =[UIColor colorWithRed:1.00 green:1.00 blue:1.00 alpha:1.00];
self.hotKeyArray = [[NSMutableArray alloc] init]; self.netWorking = [BaseSVRRequestOperator new];
self.guideArray = [NSMutableArray new];
self.shopArray = [NSMutableArray new]; [self initLeftBarButtonItem];
/*
[self initRightBarButtonItem000];
[self searchBarInit000];
*/
[self initRightBarButtonItem];
[self searchBarInit]; [self setHeadView]; if([DBStrore sharedDBStore].HistorySearchArray.count > )
{
self.historySearchArray = [[NSMutableArray alloc] initWithArray:[DBStrore sharedDBStore].HistorySearchArray];
}
else
{
self.historySearchArray = [NSMutableArray new];
} if([DBStrore sharedDBStore].hotKeyArray.count > )
{
self.hotKeyArray = [DBStrore sharedDBStore].hotKeyArray;
}
else
{
[self getHotSearchKeyword]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideBarSearch:) name:@"hideBarSearch" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(freshCapPicCount:) name:@"freshCapPicCount" object:nil];
} - (void)hideBarSearch:(id)notification
{
[self.searchBar resignFirstResponder];
} - (void)setHeadView
{
} - (void)detailBtn
{
[self.searchBar resignFirstResponder];
} - (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:YES];
self.navigationController.navigationBarHidden = NO;
//开启定时器
// [scrollView.myTimer setFireDate:[NSDate distantPast]];
NSLog(@"search viewWillAppear:%d",[DBStrore sharedDBStore].CapPicArray.count);
[_mLookPicButton setTitle:[NSString stringWithFormat:@"对比(%d)",[DBStrore sharedDBStore].CapPicArray.count] forState: UIControlStateNormal];
} - (void)lookPicBtnClick
{
PicViewController *picVC = (PicViewController *)[[UIStoryboard storyboardWithName:@"picview" bundle:nil] instantiateViewControllerWithIdentifier:@"PicViewController"]; [self.navigationController pushViewController:picVC animated:YES]; } -(void) freshCapPicCount:(NSNotification*)notify
{
NSLog(@"search view freshCapPicCount:%d",[DBStrore sharedDBStore].CapPicArray.count);
[_mLookPicButton setTitle:[NSString stringWithFormat:@"对比(%d)",[DBStrore sharedDBStore].CapPicArray.count] forState: UIControlStateNormal];
} //导航栏左边按钮
- (void)initLeftBarButtonItem
{
NSLog(@"返回"); UIButton *backimgbtn = [[UIButton alloc] initWithFrame:CGRectMake(,,,)];
[backimgbtn setImage:[UIImage imageNamed:@"back_b.png"]forState:UIControlStateNormal];
[backimgbtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
[backimgbtn setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
backimgbtn.backgroundColor = [UIColor clearColor];
[backimgbtn setTitleColor:[UIColor redColor]forState:UIControlStateNormal];
backimgbtn.titleLabel.font = [UIFont systemFontOfSize: 15.0];
[backimgbtn addTarget:self action:@selector(cancelNav) forControlEvents:UIControlEventTouchUpInside]; UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftButton setTitle:@"返回" forState:UIControlStateNormal];
[leftButton setTitle:@"返回" forState:UIControlStateHighlighted];
[leftButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
[leftButton setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
[leftButton setTitleColor:self.view.tintColor forState:UIControlStateNormal];
leftButton.titleLabel.font = [UIFont systemFontOfSize:];
[leftButton addTarget:self action:@selector(cancelNav) forControlEvents:UIControlEventTouchUpInside];
[leftButton setFrame:CGRectMake(,,,)]; UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(, , , )]; [leftView addSubview:backimgbtn];
[leftView addSubview:leftButton]; UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftView]; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
{
UIBarButtonItem *negativeSeperator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
negativeSeperator.width = -;
[self.navigationItem setLeftBarButtonItems:@[negativeSeperator, leftBarButtonItem]];
}
else
{
[self.navigationItem setLeftBarButtonItem:leftBarButtonItem animated:NO];
} }
//导航栏右边按钮
- (void)initRightBarButtonItem
{
NSLog(@"对比");
UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
[rightButton setTitle:@"对比(..)" forState:UIControlStateNormal];
[rightButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentCenter];
[rightButton setTitleColor:self.view.tintColor forState:UIControlStateNormal];
rightButton.titleLabel.font = [UIFont systemFontOfSize:];
[rightButton addTarget:self action:@selector(lookPicBtnClick) forControlEvents:UIControlEventTouchUpInside];
[rightButton setFrame:CGRectMake(, , , )];
UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton]; if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
{
UIBarButtonItem *negativeSeperator = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
negativeSeperator.width = -;
[self.navigationItem setRightBarButtonItems:@[negativeSeperator, rightBarButtonItem]];
}
else
{
[self.navigationItem setRightBarButtonItem:rightBarButtonItem animated:NO];
}
_mLookPicButton=rightButton; /*
[self.navigationItem setLeftBarButtonItem:nil];
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
[leftButton setFrame:CGRectMake(0, 0, 0, 0)];
// [leftButton setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
[self.navigationItem setLeftBarButtonItem:leftBarButtonItem];
*/
} //初始化搜索栏
- (void)searchBarInit { UIView *searchView = [[UIView alloc] initWithFrame:CGRectMake(, , kScreenWidth - , )];
searchView.backgroundColor = [UIColor clearColor]; self.searchBar = [[personSearch alloc] initWithFrame:CGRectMake(, , searchView.frame.size.width, searchView.frame.size.height)];
self.searchBar.backgroundColor = [UIColor clearColor];
self.searchBar.showsScopeBar = NO;
if(IsiOS8Later)
{
self.searchBar.returnKeyType = UIReturnKeySearch;
}
self.searchBar.delegate = self;
[self.searchBar becomeFirstResponder];
[searchView addSubview:self.searchBar]; self.navigationItem.titleView = searchView; } - (void)cancelNav{
[self.searchBar resignFirstResponder];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self.navigationController popViewControllerAnimated:YES];
} - (void)cleanHis:(id)sender{ [self.historySearchArray removeAllObjects];
[[DBStrore sharedDBStore].HistorySearchSet removeAllObjects];
[[DBStrore sharedDBStore].HistorySearchArray removeAllObjects];
[self.tableView reloadData]; [self saveSearchHistory]; }
- (void)getHotSearchKeyword
{
HttpConnect * connect = [[HttpConnect alloc] init];
connect.delegate = self;
// NSNumber *lastid = [NSNumber numberWithInt:self.last_id];
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
// [dic setObject:lastid forKey:@"lastid"]; [connect postRequestForPostValue:dic url:@"gethotkey.php" requestTag:]; }
-(void)postRequestStarted:(AFHTTPRequestOperation*)request manage:(AFHTTPRequestOperationManager*)manage{ NSLog(@"REQ START");
}
// 从服务器取热门搜索关键字的回调
-(void)postRequestFinished:(AFHTTPRequestOperation*)request manage:(AFHTTPRequestOperationManager*)manage{ NSLog(@"REQ FINISHED"); NSDictionary * dictionary = [NSJSONSerialization JSONObjectWithData:request.responseData options:NSJSONReadingMutableLeaves error:nil ];
NSString * status = [NSString stringWithFormat:@"%@",[dictionary objectForKey:@"status"]];
// NSLog(@"status=%@",status);
if([status isEqualToString: @""]){
NSArray *dataArray = [request.responseObject objectForKey:@"data"];
NSLog(@"count=%d",dataArray.count);
if(dataArray)
{
for(int i=;i<dataArray.count;i++)
{
[self.hotKeyArray addObject:[dataArray objectAtIndex:i]];
}
} [self.tableView reloadData]; [DBStrore sharedDBStore].hotKeyArray = self.hotKeyArray; }
}
-(void)postRequestFailed:(AFHTTPRequestOperation*)request manage:(AFHTTPRequestOperationManager*)manage{ NSLog(@"REQ FAILED");
// [self.view addSubview:[CustomAlertView alertWith:@"0" message:NSLocalizedString(@"error", @"错误")]];
} #pragma mark - UISearchBar delegate
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
NSLog(@"searchBarTextDidBeginEditing");
[self.searchBar becomeFirstResponder];
} - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar
{
NSLog(@"searchBarTextDidEndEditing");
[self.searchBar resignFirstResponder];
} - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
NSLog(@"searchBarSearchButtonClicked");
[self.searchBar resignFirstResponder];
[self starSearch:self.searchBar.text];
}
//
- (void)starSearch:(NSString *)key
{ if(key.length > )
{
key = [NSString stringWithFormat:@"%@...",[key substringToIndex:]];
} if (![[DBStrore sharedDBStore].HistorySearchSet containsObject:key]) { if([DBStrore sharedDBStore].HistorySearchArray.count == )
{
NSString *name = [DBStrore sharedDBStore].HistorySearchArray[];
[[DBStrore sharedDBStore].HistorySearchSet removeObject:name];
[[DBStrore sharedDBStore].HistorySearchArray removeObjectAtIndex:];
[self.historySearchArray removeObjectAtIndex:];
} [[DBStrore sharedDBStore].HistorySearchSet addObject:key];
[[DBStrore sharedDBStore].HistorySearchArray insertObject:key atIndex:];
[self.historySearchArray insertObject:key atIndex:]; [self saveSearchHistory]; [self.tableView reloadData]; } [self getSearchMessage:key];
} - (void)saveSearchHistory
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *bindUserLocalSettingDictionaryData = [NSKeyedArchiver archivedDataWithRootObject:[DBStrore sharedDBStore].HistorySearchArray];
[defaults setObject:bindUserLocalSettingDictionaryData forKey:FTsearchHistory];
[defaults synchronize]; } - (void)getSearchMessage:(NSString *)keyName
{ [DBStrore sharedDBStore].searchKey = keyName; [self.hotKeyArray removeAllObjects];
self.tableView.tableHeaderView = nil;
[self.tableView reloadData]; if(!self.searchResultView)
{
self.searchResultView = [[SearchResultViewController alloc] initWithNibName:@"SearchResultViewController" bundle:nil];
self.searchResultView.view.frame = CGRectMake(, , kScreenWidth, kScreenHeight - );
self.searchResultView.delegate = self;
[self.view addSubview:self.searchResultView.view]; } [self.searchResultView getSearchListByKey:keyName]; } - (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
[self.searchBar resignFirstResponder];
} #pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ;
} - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ if(self.hotKeyArray.count > )
{
return ;
}
else
{
return ;
} } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *view = [[UIView alloc] initWithFrame:CGRectMake(, , SCREEN_WIDTH, )];
view.backgroundColor = [UIColor clearColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(, , SCREEN_WIDTH-, )];
label.textColor = [UIColor colorWithRed:0.77 green:0.77 blue:0.78 alpha:1.00];
if (section == ) { if(self.historySearchArray.count > )
{
label.text = @"历史搜索";
} }else{ if(self.hotKeyArray.count > )
{
label.text = @"热门搜索";
} }
[view addSubview:label]; return view;
} - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(, , SCREEN_WIDTH, )];
view.backgroundColor = [UIColor clearColor];
if (section == ) {
return view;
} if(self.historySearchArray.count > )
{
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
button.layer.cornerRadius = ;
button.layer.borderWidth = 0.5;
button.layer.borderColor = [UIColor lightGrayColor].CGColor;
[button setTitleColor:[UIColor colorWithRed:0.98 green:0.32 blue:0.32 alpha:1.00] forState:UIControlStateNormal];
[button setTitle:@"清除历史记录" forState:UIControlStateNormal];
[button addTarget:self action:@selector(cleanHis:) forControlEvents:UIControlEventTouchUpInside];
[button.titleLabel setFont:[UIFont systemFontOfSize:]];
[button setBackgroundColor:[UIColor whiteColor]];
[button setImage:[UIImage imageNamed:@"clear"] forState:UIControlStateNormal]; [view addSubview:button];
} return view;
} - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return ;
} - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if(section == ){
return ;
}
return ;
} - (void)configureCell:(TagsTableCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
cell.tagView.preferredMaxLayoutWidth = SCREEN_WIDTH;
cell.tagView.padding = UIEdgeInsetsMake(, , , );
cell.tagView.insets = ;
cell.tagView.lineSpace = ; [cell.tagView removeAllTags]; NSArray *array = nil;
if(indexPath.section == ){
array = self.historySearchArray;
}
else
{
array = self.hotKeyArray;
} //Add Tags
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
{
SKTag *tag = [SKTag tagWithText:obj];
tag.textColor = [UIColor blackColor];
tag.fontSize = ;
tag.padding = UIEdgeInsetsMake(, , , );
tag.bgImg = [UIImage imageWithColor:[UIColor clearColor]];
tag.cornerRadius = ;
tag.borderColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.89 alpha:1.00];
tag.borderWidth = ;
tag.tag = idx;
[cell.tagView addTag:tag];
}];
cell.tagView.backgroundColor = [UIColor clearColor];
cell.backgroundColor = [UIColor clearColor];
cell.tagView.tag = indexPath.section;
__weak TagsTableViewController *weakSelf = self;
cell.tagView.didClickTagAtIndex = ^(NSUInteger index,NSUInteger tag){
[weakSelf handleBtn:tag index:index];
}; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
TagsTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kTagsTableCellReuseIdentifier forIndexPath:indexPath];
[self configureCell:cell atIndexPath:indexPath]; return cell;
} #pragma mark - Table view delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
TagsTableCell *cell = nil;
if (!cell)
{
cell = [tableView dequeueReusableCellWithIdentifier:kTagsTableCellReuseIdentifier];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
} [self configureCell:cell atIndexPath:indexPath];
return [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height + ;
} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
} #pragma mark - User interactions
//写点击事件。。。
- (void)handleBtn:(NSUInteger)section index:(NSUInteger)index
{
NSString *searchName = nil;
if(section == )
{
searchName = self.hotKeyArray[index];
}
else
{
searchName = self.historySearchArray[index];
} self.searchBar.text = searchName;
[self.searchBar resignFirstResponder]; [self starSearch:searchName];
} @end @implementation UIImage (SKTagView) + (UIImage *)imageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect); UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); return image;
} @end

加扣群385378208即可下载工程源码,先看群信息

iOS开发总结-搜索功能实现--使用SKTag的更多相关文章

  1. IOS开发之支付功能概述

    前言:本随笔将对IOS开发的支付功能进行一个概述. 内容大纲: 一.常见的支付方案简介 二.第三方支付SDK 三.苹果官方支付方案 四.Web支付方案 正文: 一.常见的支付方案简介 在微信支付中 微 ...

  2. Yii 1开发日记 -- 搜索功能及Checkbox的实现

    用yii 1实现后台的搜索功能,效果如下图: 1.模型中: public function search() { $criteria = new CDbCriteria; //独立高级搜索 if(is ...

  3. ios开发之--搜索框的使用(PYSearchViewController的使用)

    最近需要开发搜索框,比较了以前的各个版本的搜索框,UISearchDisplayController和UISearchController的使用,以后再做记录,随着ios11的更新,一些控件发生了,改 ...

  4. iOS开发之语音功能实现

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launc ...

  5. 【IOS开发】搜索和排序(好友列表,通讯录的实现,searchbar)

    一.效果图: 二.概述 实现一个好友列表,可以分为男女两个选项,并且实现搜索和排序功能.我的数据是放在plist文件中. 三.代码简述 代码结构如图,首先自定义一个Cell. cell.h #impo ...

  6. iOS开发: 向右滑动手势功能实现

    在navigationController中实现向右滑动 返回功能 系统提供的backbarbuttonitem,不用添加任何代码即可实现向右滑动后退功能,但是往往要对按钮修改样式等时,就需要自定义l ...

  7. iOS开发-清理缓存功能的实现

    移动应用在处理网络资源时,一般都会做离线缓存处理,其中以图片缓存最为典型,其中很流行的离线缓存框架为SDWebImage. 但是,离线缓存会占用手机存储空间,所以缓存清理功能基本成为资讯.购物.阅读类 ...

  8. iOS开发系统类功能划分

    0.OC语法基础 CHOCBase Object C语法学习笔记(一) Object C语法学习笔记(二) 1.UI类 自定义控件程序运行流程 setNeedsLayOut和setNeedsDispl ...

  9. iOS开发打电话的功能

    1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示 NSMutableString * phoneStr=[[NSMutableString alloc] init ...

随机推荐

  1. Angularjs中编写指令模版

    angular.module('moduleName', []).directive( 'namespaceDirectiveName', [ function() { return { restri ...

  2. Nginx 独立图片服务器的搭建

    为什么需要独立图片服务器? 如果你留心的话,可以发现,现在主流的网站都是有单独的图片服务器的,例如,人人网的为rrimg,淘宝的为taobaocdn,下面还有很多的二级域名. 独立的图片服务器有诸多好 ...

  3. jquery mobile基本结构搭建

    官网:http://jquerymobile.com/ 基本结构:

  4. 配置并学习微信JS-SDK(3)—菜单接口

    1.设置菜单 //2.批量显示菜单项接口 wx.showMenuItems({   menuList: [     'menuItem:profile', //查看公众号     'menuItem: ...

  5. Curl 采集乱码 gzip 原因及解决方案 utf-8

    用curl获取一个经过gzip压缩后的网页时返回乱码 原因大体就是服务器返回的Content-Encoding的值和网页的编码不同,造成curl解码出问题,直接将gzip或deflate编码的文件下载 ...

  6. Balsamiq Mockups

    Balsamiq Mockups完全手册 2010.03.18 发布 48,066 浏览 什么是Balsamiq Mockups Balsamiq Mockups出自加利福尼亚州的Balsamiq工作 ...

  7. Silverlight中在MVVM模式下对DatagridRow选择控件封装

    在项目中,凡是涉及到表格的地方用的最多的控件,自然少不了DataGrid的身影,它明了的展示各种数据让人十分喜欢.现在要实现一个功能,使DataGrid具有全选和项选中的功能,如果在传统后台代码中完成 ...

  8. C语言实现五子棋简单功能

    /******************************************************************** C-4.29-1: 实现五子棋游戏 操作说明:用方向键或者& ...

  9. C# Json反序列化处理

    最近换工作了 从客户端转到Web端 第一个任务就是去别人的页面上抓取数据 用到的是JSON 因为他们网站json的格式有点怪 所以 就在JSON反序列化上面 花了一点时间 首先用到的工具是http:/ ...

  10. java子类实例初始化过程

    子类的实例化主要分为两个步骤: <1>.类相关静态内容 初始化: *先父类再子类:  1.父类的static属性:   2.父类的static块:   3.子类的static属性:   4 ...