Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GMGridView单元格在iOS 7中向上滚动至状态栏_Ios_Gmgridview - Fatal编程技术网

GMGridView单元格在iOS 7中向上滚动至状态栏

GMGridView单元格在iOS 7中向上滚动至状态栏,ios,gmgridview,Ios,Gmgridview,我有一个UIViewController,我正在将其设置为UINavigationController的rootviewcontroller。然后在viewcontroller中创建一个gmgridview,如下所示: NSInteger spacing = 15; GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:self.view.bounds]; gmGridView.autoresizingMask = UIViewA

我有一个UIViewController,我正在将其设置为UINavigationController的rootviewcontroller。然后在viewcontroller中创建一个gmgridview,如下所示:

NSInteger spacing = 15;

GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:self.view.bounds];
gmGridView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

[self.view addSubview:gmGridView];
_gmGridView = gmGridView;

_gmGridView.style = GMGridViewStyleSwap;
_gmGridView.itemSpacing = spacing;
_gmGridView.minEdgeInsets = UIEdgeInsetsMake(spacing, spacing, spacing, spacing);
_gmGridView.centerGrid = YES;
_gmGridView.actionDelegate = self;
_gmGridView.sortingDelegate = self;
_gmGridView.transformDelegate = self;
_gmGridView.dataSource = self;
如果我理解正确,根据iOS7的UI指南,如果使用UINavigationController,它会自动处理状态栏下的视图流。这似乎在很大程度上起了作用。因为如果我做了
\u gmGridView.backgroundColor=[UIColor blackColor]
我可以看到gridview不会在状态栏下面溢出。但是滚动时,GMGridViewCells位于状态栏下方。我不明白为什么

此图显示了背景颜色为黑色的gridview。请注意,状态栏背景不是黑色的,这告诉我gridview不会出现在它的后面

这个显示了滚动


在iOS7中,状态栏是透明的。如果不希望状态栏后面显示内容,请将根视图的框架设置为距屏幕顶部约30,并确保
clipstobunds=YES

GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:CGRectMake(0,30,self.view.bounds.size.width,self.view.bounds.size.height-30)];

在iOS7中,状态栏是透明的。如果不希望状态栏后面显示内容,请将根视图的框架设置为距屏幕顶部约30,并确保
clipstobunds=YES

GMGridView *gmGridView = [[GMGridView alloc] initWithFrame:CGRectMake(0,30,self.view.bounds.size.width,self.view.bounds.size.height-30)];

@Adam-当使用UINavgiationController时,30px偏移量是不必要的,因为它适当地添加了偏移量。@bizsytes-您实际上没有向我们显示什么背景颜色是黑色的,因此,从您发布的代码和屏幕截图中,我们无法判断
gmGridView
是否显示在状态栏后面(显然是这样)。1) 你试过我发布的代码了吗?2) 设置
gmGridView.clipstobunds=YES
嗯,我的问题有点像你要找的“因为如果我这样做了”\u gmGridView.backgroundColor=[UIColor blackColor]我可以看到gridview不会在状态栏下面溢出。但是滚动时,gmGridView单元格会在状态栏下面。”所以我猜
gmGridView.clipsToBounds=YES
(或
self.view.clipsToBounds=YES
)也不起作用?@Adam-使用UINavgiationController时不需要30px的偏移量,因为它适当地添加了偏移量。@bizzytes-您实际上没有向我们显示什么背景颜色是黑色的,所以,从您发布的代码和屏幕截图中,我们无法判断
gmGridView
是否出现在状态栏后面(显然是这样)。1) 你试过我发布的代码了吗?2) 设置
gmGridView.clipstobunds=YES
嗯,我的问题有点像你要找的“因为如果我这样做了”\u gmGridView.backgroundColor=[UIColor blackColor]我可以看到gridview不会在状态栏下面溢出。但是滚动时,gmGridView单元格会在状态栏下面。”所以我猜
gmGridView.clipstobunds=YES
(或者
self.view.clipstobunds=YES
)也不起作用?