大家也可以到这里查看。

UICollectionView是iOS6引入的控件,而UIDynamicAnimator是iOS7上新添加的框架。本文主要涵盖3部分:

一是简单概括UICollectionView的使用;二是自定义一个UICollectionViewLayout来实现不同的Collection布局;

三是在自定义UICollectionViewLayout的基础上添加UIDynamicAnimator。

1. 使用UICollectionView

因为UICollectionView在iOS6上就引入了,所以这里就简单的介绍下。在正式使用前,我们有必要对UICollectionView认识一下。

UICollectionView和UITableView有点类似,但又有不一样。从上图可以看出,组建一个UICollectionView不仅需要内容相关的对象,

如DataSource和Delegate,还需要布局相关的对象即UICollectionViewLayout。

  • Data Source:提供相关的data和view
  • Delegate: 实现点击/插入/删除等操作时需要的方法
  • Layout:提供布局view(如cell,supplementary,decoration view)需要的相关数据

熟悉UITableView的,对DataSource和Delegate应该比较亲切,他们的作用和在TableView里的完全一样。而UICollectionViewLayout是一个新的类,

他的作用就是控制所有view的显示。Layout会为每个view(如果需要显示),提供一个LayoutAttribute,通过LayoutAttribute,CollectionView就

知道如何去组织了。注意LayoutAttribute除了可以提供frame信息,还可以添加伪3D的信息和UIKit的动态信息。通过抽离布局信息,这样很好的维护了

模块间的独立性,而且也方便我们对layout进行重定义。理解这个框架图有助于理解CollectionView的渲染过程以及自定义Layout。

下面我们认识下COllectionView:

上图是UICollectionViewFlowLayout的一个布局,我们以此进行介绍:

  • Cell:如上每一个单元格就是一个cell,和UITableViewCell一样,你可以进行自定义,添加image,label等等
  • Supplementary view:图中的Header和Footer就是Supplementary view,
  • Decoration view: 图中没有显示,不过顾名思义可以理解为修饰的view,如背景之类。它和Supplemetary的区别在于,后者往往是和数据相关联的。

知道了这些,我们就可以实现一个简单的CollectionView了。

在storeboard里新建一个viewController,并在view上添加一个UICollectionView,collectionview的delegate和datasource都在SB里连接好。

为了简单,我们直接使用UICollectionViewFlowLayout:

红色和绿色的label所在处就代表header和footer,他们都是用supplementary来表示,中间的Imageview所在处代表一个cell。

代码里三者都进行了简单的继承自定义,注意给他们三者设置一个identifier,这样利于重用。

然后在代码里实现dataSource方法:

  1. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
  2. {
  3. return 2;
  4. }
  5. - (NSInteger)collectionView:(UICollectionView *)view numberOfItemsInSection:(NSInteger)section;
  6. {
  7. return 20;
  8. }
  9. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  10. {
  11. ZJCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ZJCell" forIndexPath:indexPath];
  12. NSString *imgName = [NSString stringWithFormat:@"%d.JPG",indexPath.row];
  13. cell.imageView.image = [UIImage imageNamed:imgName];
  14.  
  15. return cell;
  16. }
  17.  
  18. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  19. {
  20. ZJSupplementaryView *supplementaryView = nil;
  21. NSString *text = nil;
  22. if ([kind isEqualToString:UICollectionElementKindSectionHeader])
  23. {
  24. supplementaryView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"CLHeader" forIndexPath:indexPath];
  25. text = [NSString stringWithFormat:@"Header %d",indexPath.section];
  26. supplementaryView.backgroundColor = [UIColor darkGrayColor];
  27. }
  28. else
  29. {
  30. supplementaryView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"CLFooter" forIndexPath:indexPath];;
  31. text = [NSString stringWithFormat:@"Footer %d",indexPath.section];
  32. supplementaryView.backgroundColor = [UIColor lightGrayColor];
  33. }
  34.  
  35. supplementaryView.label.text = text;
  36. return supplementaryView;
  37. }

这样一个最简单的flow式的照片显示就实现了,成品如下:

  

2 自定义Layout

Layout类中,有3个方法是必定会被依次调用:

  1. prepareLayout: 准备所有view的layoutAttribute信息

  2. collectionViewContentSize: 计算contentsize,显然这一步得在prepare之后进行

  3. layoutAttributesForElementsInRect: 返回在可见区域的view的layoutAttribute信息

此外,还有其他方法可能会被调用:

  1. - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3. }
  4. - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  5. {
  6. }
  7. - (UICollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString *)decorationViewKind atIndexPath:(NSIndexPath *)indexPath
  8. {
  9. }
  10. - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
  11. {
  12. }

比如,如果没有Decoration view,那么相应的方法就可以不实现。

接下来我们要实现一个自定义的layout。官方文档CollectionViewPGforIOS中指出了需要自定义layout的情形:

简单的说,就是现有的类(UICollectionViewLayout和UICollectionViewFlowLayout)不能满足需要的情况下需要自定义。

下面我们来实现CollectionViewPGforIOS中的自定义的例子,如图:

文档中,已经详细的阐述了每一步需要做的事情,这里就不多说了。但是因为文档中对于实现细节没有涉及,因此这里主要还是围绕之前提到的3个方法来进行说明。

这里假设你已经看过文档,并且知道自定义所需要的步骤。还需要声明的是,文档中给出的图以及下文的文字说明都是竖状排列的,但是由于疏忽,实现的时候变成了横向。希望因此不会给你造成混淆。

前提还需要做的准备:

1 定义Layout的子类

  1. @interface ZJCustomLayout : UICollectionViewLayout
  2. @property (nonatomic, weak) id<ZJCustomLayoutProtocol> customDataSource;
  3.  
  4. @end

@interfaceZJCustomLayout ()

{

  1.  

NSInteger numberOfColumn;//here in this Sample Column equals the section

  1.  

}

  1.  

@property (nonatomic) NSDictionary *layoutInformation;//存储所有view的layoutAttribute

@property (nonatomic) CGFloat maxWidth;//用于计算contentSize

@property (nonatomic) UIEdgeInsets insets;

@end

  1.  

protocol是用来获取一些数据,稍后定义。在扩展中定义一些属性,用于存储信息。

2 定义LayoutAttribute的子类

  1. @interface ZJCollectionViewLayoutAttributes : UICollectionViewLayoutAttributes<UIDynamicItem>
  2. @property (nonatomic) NSArray *children;
  3.  
  4. @end
  5.  
  6. @implementation ZJCollectionViewLayoutAttributes
  7.  
  8. - (BOOL)isEqual:(id)object
  9. {
  10. ZJCollectionViewLayoutAttributes *attribute = (ZJCollectionViewLayoutAttributes *)object;
  11. if ([self.children isEqualToArray:attribute.children])
  12. {
  13. return [super isEqual:object];
  14. }
  15. return NO;
  16. }
  17. @end

ZJCollectionViewLayoutAttribute就是每一个cell的属性,children表示当前cell所拥有的子cell。而isEqual是子类必须要重载的。

我们首先看一下,cell是如何布局的:

红色3是cell的最终位置。布局的时候,先把最后一列的cell依次加上,如红色1所示。

然后排前一列即第二列,先依次加上,这时最后的绿色cell有子cell,就把第三列的绿色cell位置更新。

最后排第一列,因为第一个cell有3个子cell,所以要空两个开始排列。这时最后一个绿色cell有子cell这时就又要调整第二列以及第三列的绿色cell。

这里cell调整的思路很清晰:先依次从上到下排列,然后再根据是否有子cell进行更新。

在实际实现中,我根据这样的思路,设计了类似的算法:

  1. 从后向前布局每一列,每一列的cell依次从上向下布局;
  2. 除最后一列的cell开始布局时,先查看当前列前一行的cell是否有子cell:有的话调整自己的位置
  3. 如果当前cell的位置进行了调整,那么调整自己子cell的位置

很显然,在初始化每个cell的layoutAttribute的时候,我们需要先知道每一个cell的子cell的情况,于是我们设计一个协议:

  1. @protocol ZJCustomLayoutProtocol <NSObject>
  2.  
  3. - (NSArray *)childrenAtIndexPath:(NSIndexPath *)indexPath;
  4. @end

这个和CollectionView的dataSource,delegate一样,由viewController来提供。

接下来我们开始实现:

  1. - (void)prepareLayout
  2. {
  3.  
  4. if (self.layoutInformation)
  5. {
  6. return;
  7. }
  8. //whole size preparation
  9. NSMutableDictionary *layoutInformation = [NSMutableDictionary dictionary];
  10. NSMutableDictionary *cellInformation = [NSMutableDictionary dictionary];
  11. NSIndexPath *indexPath;
  12. NSInteger numSections = [self.collectionView numberOfSections];
  13. numberOfColumn = numSections;
  14. //初始化attribute
  15. for(NSInteger section = ; section < numSections; section++)
  16. {
  17. NSInteger numItems = [self.collectionView numberOfItemsInSection:section];
  18. for(NSInteger item = ; item < numItems; item++)
  19. {
  20. indexPath = [NSIndexPath indexPathForItem:item inSection:section];
  21. ZJCollectionViewLayoutAttributes *attributes = [self attributesWithChildrenAtIndexPath:indexPath];
  22. // attributes.zIndex = -(0 + 1);
  23. // attributes.transform = CGAffineTransformMakeRotation(.1);
  24. // attributes.transform3D = CATransform3DMakeRotation(.3, 0, 0, 1);
  25. [cellInformation setObject:attributes forKey:indexPath];
  26.  
  27. }
  28. }
  29. //从最后向前开始逐个调整attribute
  30. for(NSInteger section = numSections - ; section >= ; section--)
  31. {
  32. NSInteger numItems = [self.collectionView numberOfItemsInSection:section];
  33. NSInteger totalHeight = ;
  34. for(NSInteger item = ; item < numItems; item++)
  35. {
  36. indexPath = [NSIndexPath indexPathForItem:item inSection:section];
  37. ZJCollectionViewLayoutAttributes *attributes = [cellInformation objectForKey:indexPath];//
  38. attributes.frame = [self frameForCellAtIndexPath:indexPath withHeight:totalHeight];
  39.  
  40. // begin adjust the frame and its children's frame
  41. if (item)
  42. {
  43. NSIndexPath *previousIndex = [NSIndexPath indexPathForRow:item - inSection:section];
  44. ZJCollectionViewLayoutAttributes *previousAttribute = cellInformation[previousIndex];
  45. CGRect rect = attributes.frame;
  46. CGRect previousRect = previousAttribute.frame;
  47. rect.origin.x = previousRect.origin.x + previousRect.size.width + CELL_ROW_SPACE;
  48. //前一个cell是否有孩子
  49. if (previousAttribute.children)
  50. {
  51. ZJCollectionViewLayoutAttributes *preLastChildAttri = cellInformation[previousAttribute.children.lastObject];
  52. CGRect preLastChildFrame = preLastChildAttri.frame;
  53. rect.origin.x = preLastChildFrame.origin.x + preLastChildFrame.size.width + CELL_ROW_SPACE;
  54. // rect.origin.x += (CELL_WIDTH + CELL_ROW_SPACE) * (previousAttribute.children.count - 1);
  55. }
  56. attributes.frame = rect;
  57. //调整自己的子cell
  58. if (attributes.children)
  59. {
  60. NSUInteger childrenCount = attributes.children.count;
  61. CGFloat baseOffset = rect.origin.x;
  62.  
  63. for (NSUInteger count = ; count < childrenCount; count ++)
  64. {
  65. NSIndexPath *childIndexpath = attributes.children[count];;
  66. ZJCollectionViewLayoutAttributes *childAttri = cellInformation[childIndexpath];
  67. CGRect childRect = childAttri.frame;
  68. childRect.origin.x = baseOffset + count *(CELL_WIDTH + CELL_ROW_SPACE);
  69. childAttri.frame = childRect;
  70. }
  71. }
  72.  
  73. }
  74. //记录最大的长度(宽度)
  75. CGFloat currentWidth = attributes.frame.origin.x + attributes.frame.size.width;
  76. if (self.maxWidth < currentWidth)
  77. {
  78. self.maxWidth = currentWidth;
  79. }
  80.  
  81. cellInformation[indexPath] = attributes;
  82. // totalHeight += [self.customDataSource numRowsForClassAndChildrenAtIndexPath:indexPath];//
  83.  
  84. }
  85.  
  86. }
  87.  
  88. [layoutInformation setObject:cellInformation forKey:@"MyCellKind"];//

通过这里获得的数据我们可以返回contentSize了。虽然高度上会有调整,但是宽度上是和section绑定的。

  1. - (CGSize)collectionViewContentSize
  2. {
  3.  
  4. CGFloat width = self.maxWidth + CELL_ROW_SPACE;
  5. CGFloat height = self.collectionView.numberOfSections * (CELL_HEIGHT + CELL_SEC_SPACE) + self.insets.top + self.insets.bottom;
  6.  
  7. return CGSizeMake(width, height);
  8.  
  9. }

接下来就要实现layoutAttributesForElementsInRect,这个通过CGRectIntersectsRect来选择是否在当前的rect里:

  1. - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
  2. {
  3. NSMutableArray *myAttributes = [NSMutableArray arrayWithCapacity:self.layoutInformation.count];
  4. for (NSString *key in self.layoutInformation)
  5. {
  6. NSDictionary *attributesDict = [self.layoutInformation objectForKey:key];
  7. for (NSIndexPath *indexPath in attributesDict)
  8. {
  9. ZJCollectionViewLayoutAttributes *attributes = [attributesDict objectForKey:indexPath];
  10. if (CGRectIntersectsRect(rect, attributes.frame))
  11. {
  12. [myAttributes addObject:attributes];
  13. }
  14. }
  15. }
  16.  
  17. return myAttributes;
  18.  
  19. }

然后在viewController类里实现datasource,不要忘记实现我们自定义的protocol。这样,我们就能看到所有的cell了。

接下来我们就要实现cell间的连线。连线我是作为supplementary view来处理。如果一个cell有子cell,那么就设置view,并记录点的相应位置,如图:

因此仿照cell的处理方式,定义了suppleLayoutAttribute,主要用于存储点:

  1. @interface ZJCollectionSuppleLayoutAttributes : UICollectionViewLayoutAttributes
  2. @property (nonatomic) NSArray *pointArray;
  3. @end

然后继承了UICollectionReusableView用于划线:

  1. @interface ZJClassReusableView()
  2. @property (nonatomic) NSArray *pointArray;
  3. @end
  4.  
  5. @implementation ZJClassReusableView
  6.  
  7. - (id)initWithFrame:(CGRect)frame
  8. {
  9. self = [super initWithFrame:frame];
  10. if (self) {
  11. // Initialization code
  12. self.backgroundColor = [UIColor darkGrayColor];
  13. }
  14. return self;
  15. }
  16.  
  17. // Only override drawRect: if you perform custom drawing.
  18. // An empty implementation adversely affects performance during animation.
  19. - (void)drawRect:(CGRect)rect
  20. {
  21. [super drawRect:rect];
  22. // Drawing code
  23.  
  24. CGRect frame = self.frame;
  25. CGContextRef context = UIGraphicsGetCurrentContext();
  26. CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
  27. CGContextSetLineWidth(context, );
  28. NSUInteger count = self.pointArray.count;
  29. for (NSUInteger num = ; num < count; num ++)
  30. {
  31. CGPoint point = [[self.pointArray objectAtIndex:num] CGPointValue];
  32. CGFloat xPosition = point.x - frame.origin.x;
  33.  
  34. if (num == )
  35. {
  36. CGContextMoveToPoint(context, xPosition, );
  37. CGContextAddLineToPoint(context, xPosition, rect.size.height);
  38. }
  39. else
  40. {
  41. CGContextMoveToPoint(context, xPosition, frame.size.height/);
  42. CGContextAddLineToPoint(context, xPosition, rect.size.height);
  43. }
  44.  
  45. }
  46. if (count > )
  47. {
  48. CGPoint first = [[self.pointArray objectAtIndex:] CGPointValue];
  49. CGPoint last = [[self.pointArray lastObject] CGPointValue];
  50.  
  51. CGContextMoveToPoint(context, first.x - frame.origin.x, frame.size.height/);
  52. CGContextAddLineToPoint(context, last.x - frame.origin.x + , frame.size.height/);
  53. }
  54.  
  55. CGContextStrokePath(context);
  56. }
  57.  
  58. - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
  59. {
  60. [super applyLayoutAttributes:layoutAttributes];
  61.  
  62. self.pointArray = ((ZJCollectionSuppleLayoutAttributes *)layoutAttributes).pointArray;
  63. }
  64. @end

而在customLayout中,需要添加:

  1. //frame for supplement view
  2. NSMutableDictionary *suppleDict = [NSMutableDictionary dictionary];
  3. for(NSInteger section = ; section < numSections; section++)
  4. {
  5. NSInteger numItems = [self.collectionView numberOfItemsInSection:section];
  6. for(NSInteger item = ; item < numItems; item++)
  7. {
  8. indexPath = [NSIndexPath indexPathForItem:item inSection:section];
  9. ZJCollectionSuppleLayoutAttributes *suppleAttri = [ZJCollectionSuppleLayoutAttributes layoutAttributesForSupplementaryViewOfKind:ZJSupplementKindDiagram withIndexPath:indexPath];
  10.  
  11. ZJCollectionViewLayoutAttributes *cellAttribute = cellInformation[indexPath];
  12. NSArray *cellChildren = cellAttribute.children;
  13. if (cellChildren)
  14. {
  15. NSUInteger childrenCount = cellChildren.count;
  16. //calculate the frame
  17. CGRect cellFrame = cellAttribute.frame;
  18. CGRect suppleFrame = cellFrame;
  19. suppleFrame.origin.y = cellFrame.origin.y + cellFrame.size.height;
  20. suppleFrame.size.height = CELL_SEC_SPACE;
  21.  
  22. NSMutableArray *mPointArray = [NSMutableArray arrayWithCapacity:childrenCount];
  23. for (NSUInteger childNum = ; childNum < childrenCount; childNum ++)
  24. {
  25. NSIndexPath *firstIndexPath = [cellChildren objectAtIndex:childNum];
  26. ZJCollectionViewLayoutAttributes *firstChildAttri = cellInformation[firstIndexPath];
  27. CGRect firstChildFrame = firstChildAttri.frame;
  28. CGPoint firstPoint = CGPointMake(firstChildFrame.origin.x + firstChildFrame.size.width /, firstChildFrame.origin.y + firstChildFrame.size.height /);
  29.  
  30. [mPointArray addObject:[NSValue valueWithCGPoint:firstPoint]];
  31.  
  32. if (childNum == childrenCount - )
  33. {
  34. suppleFrame.size.width = firstChildFrame.origin.x + firstChildFrame.size.width - suppleFrame.origin.x;
  35. }
  36. }
  37. suppleAttri.frame = suppleFrame;
  38. suppleAttri.pointArray = mPointArray;
  39.  
  40. }
  41. [suppleDict setObject:suppleAttri forKey:indexPath];
  42. }
  43. }

这样一个树状结构的图就完成了。

3 添加动态行为UIKitDynamic

本身这段时间在学习UIDynamicAnimator,正好学到和collectionView的部分,觉得对CollectionView不太熟悉,就先温习了一遍。

所以UIDynamicanimator其实是重点。我的主要参考资料是WWDC2013 221,以及collection-views-and-uidynamics

主要实现了Cell的动态动画,当拖动collectionView的时候,cell会晃动。

具体的添加方法我就不详细解说了,这里主要说明下自定义的layout添加UIDynamicAnimator需要注意的地方。

  1. - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
  2. {
  3. ....
  4. //之前的代码后要添加
  5. NSArray *array = [self.dynamicAnimator itemsInRect:rect];
  6. [myAttributes addObjectsFromArray:array];
  7. }

不知道为什么一定要通过这样的方式把添加到DynamicAnimator的Cell属性取出来,否则cell就会不显示。

还有就是在shouldInvalidateLayoutForBoundsChange中动态更新DynamicItem,否则动画无从启动。

4 总结

主要涉及UICollectionView的使用,简单的自定义UICollectionViewLayout,以及添加UIKitDynamic。

关于CollectionView的点击,插入,删除等操作没有涵盖。

另外,自定义Layout的时候没有考虑性能,比如cell数量大的时候,现有prepare中的方式无疑会造成程序页面变卡;

添加的动态行为没有很好的修饰,纯粹为了说明两者结合的方法。

本文使用到的图片都来自官方文档和本人demo的截图。

关于UIKitDynamic,可以参阅初窥UIKit Dynamic

最后附上代码,请大家指正。

CollectionSample

自定义UICollectionViewLayout并添加UIDynamic的更多相关文章

  1. 自定义UICollectionViewLayout并添加UIDynamic - scorpiozj(转)

    转载自:http://www.tuicool.com/articles/jM77Vf     自定义UICollectionViewLayout并添加UIDynamic UICollectionVie ...

  2. 自定义UICollectionViewLayout 布局实现瀑布流

    自定义 UICollectionViewLayout 布局,实现瀑布流:UICollectionView和UICollectionViewCell 另行创建,这只是布局文件, 外界控制器只要遵守协议并 ...

  3. 每日学习心得:SharePoint 2013 自定义列表项添加Callout菜单项、文档关注、SharePoint服务端对象模型查询

    前言: 前一段时间一直都比较忙,没有什么时间进行总结,刚好节前项目上线,同时趁着放假可以好好的对之前遇到的一些问题进行总结.主要内容有使用SharePoint服务端对象模型进行查询.为SharePoi ...

  4. 自定义UICollectionViewLayout 实现瀑布流

    今天研究了一下自定义UICollectionViewLayout. 看了看官方文档,要自定义UICollectionViewLayout,需要创建一个UICollectionViewLayout的子类 ...

  5. 自定义ScrollView 支持添加头部

    自定义ScrollView 支持添加头部并且对头部ImageView支持放大缩小,上滑头部缩小,下滑头部显示放大 使用方式: scrollView = (MyScrollView) findViewB ...

  6. iOS 关于自定义UICollectionViewLayout实现复杂布局

    UICollectionView的简单介绍 UICollectionView的结构 Cells Supplementary Views 追加视图 (类似Header或者Footer) Decorati ...

  7. amazeui的表单开关插件的自定义事件必须添加.bootstrapSwitch 命名空间,给了我们什么启示

    amazeui的表单开关插件的自定义事件必须添加.bootstrapSwitch 命名空间,给了我们什么启示 一.总结 一句话总结:详细看使用文档(说明文档说的真的是非常详细呢,不过循序渐进,不同阶段 ...

  8. 如何在CSDN博客自定义栏目中添加“给我写信”

    在"自定义栏目"中添加"连接"(将自己的微博,QQ空间和CSDN博客关联起来)很多人都做过.但是添加"给我写信"这个功能,用的好像不太多.此 ...

  9. 自定义UICollectionViewLayout之CATransform3D

    1.自定义UICollectionViewLayout旋转效果 之前有自定义UICollectionViewLayout(适用于多个section),本文是一个对cell进行CATransform3D ...

随机推荐

  1. jquery中的$().each和$.each的区别

    jquery中的$().each和$.each的区别 注意:jquery中的$().each和$.each的区别,前者只能遍历数组,后者可以遍历数组和对象 备注:sinobook项目中地名本体相关地按 ...

  2. 理解JS表达式

    表达式:是由运算元和运算符(可选)构成,并产生运算结果的语法结构. 基本表达式 以下在ES5中被称为基本表达式(Primary Expression) this.null.arguments等内置的关 ...

  3. Sql-exec

    --显示sql server现有的所有数据库 exec sp_helpdb --查看数据表设置的约束 exec sp_helpconstraint SubjectType --update selec ...

  4. Windows 8 Metro风格颜色表-Metro colours

    http://huaban.com/pins/538986818

  5. google离线小恐龙-备份

    开启方法: 地址栏输入: chrome://dino 空格开始

  6. Windows ->> Windows下一代文件系统 -- Resilient file system(ReFS)

    Comming soon!!! 参考文献: Building the next generation file system for Windows: ReFS ReFS: What you need ...

  7. windows远程桌面无法粘贴复制的解决方法

    案例一:未勾选剪贴板,进入 远程桌面连接选项“本地资源->本地设备和资源->剪贴板”中,勾选剪贴板. 案例二:已勾选剪贴板,但是无法粘贴复制,进入远程服务器,关闭[rdpclip.exe] ...

  8. CVE-2015-1642 POC

    月初,玄武实验室的“每日安全动态”推送了一篇office UAF漏洞利用的文章,之前对office上UAF漏洞利用占位问题有些疑问,刚好就借助这篇文章重现了一下.其中堆喷射部分不是特别稳定,漏洞成因和 ...

  9. linux命令整理

    Linux系统命令 1. ls 查看某个 目录下 所有文件的大小总和 ls -lR| awk 'BEGIN{size=0;} /^[-l]/{size+=$5;print $0;} END{print ...

  10. crt文件上传下载

    为了方便修改文件,下载与修改服务器文件,便利很多啊! 主要命令: sz filename #下载 rz 参数 #上传 弹窗选择文件 如果没有安装请装工具: yum install lrzsz man ...