Uitableview Group模式顶部空白

1、看图说话:

iOS-Simulator-Screen-Shot-2015年6月23日-上午10.21.15

2、在plain模式下是看不类似东西的,有几种方式可以去掉该空白:

2.1、通过设置sectionHeaderHeight属性消除
self.tableView.sectionHeaderHeight = 0;
这种方式不完全好用,有时候不能完全消除,再往下走。

2.2、通过tableViewcontentInset属性将视图上移,具体数值慢慢调咯
self.tableView.contentInset = UIEdgeInsetsMake(-30, 0, 0, 0);

2.3、上述这种方式一般是可用的,但如果带下拉刷新控件的话,设置contenetInset属性[……]

继续阅读

Linux下添加新硬盘并挂载使用

1、 查看新磁盘信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@Crayfish ~]# fdisk -l
 
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00060953
 
    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1        2611    20970496   83  Linux
 
Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

2、硬盘分区

2.1、进入fdisk模式

1
2
3
4
5
6
7
8
9
10
11
[root@Crayfish ~]# fdisk /dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xc233737d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

2.2、输入n进行分区
[……]

继续阅读

关于字符串显示长度sizeWithFont要说几句

1、在iOS7之前,动态布局场景中,由于初始化UILable的大小与实际需要显示的文字内容有时候会冲突,简单一点讲UILable初始时设小了,文字过多显示不完,或者初始设置太大了,文字较少,显示效果过于空荡。

2、如何解决这个问题呢,一般需要用到NSString的两个相关方法:

– (CGSize)sizeWithFont:(UIFont *)font

– (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size

3、这两个方法相信很多人都不陌生,但在iOS7之后此类方法都已过期,官方不推荐使用,取而代之的对应两个方法为:

– (CGSize)sizeWithAttributes:(NSDictionary *)attrs

– (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options attributes:(NSDictionary *)attributes context:(NSStringDrawingContext *)context[……]

继续阅读