Tag: 间距

UICollectionViewFlowLayout minimumLineSpacing不适用于整个集合视图 – Swift

我正在为日历创buildUIView子类,其中带有stream布局的UICollectionView用于显示date。 代码是: override func draw(_ rect: CGRect) { super.draw(rect) . . configureCalendarView() . } func configureCalendarView() { cellWd = Double(self.frame.size.width)/7.0 let layout = UICollectionViewFlowLayout.init() layout.minimumLineSpacing = 0.5 layout.minimumInteritemSpacing = 0.0 layout.sectionInset = UIEdgeInsetsMake(1, 0, 0, 0) collectionV = UICollectionView.init(frame: CGRect(x: 0, y:90, width:self.frame.size.width, height:CGFloat(cellWd * 5 + 3.5)), collectionViewLayout: layout) collectionV?.backgroundColor = self.backgroundColor collectionV?.isScrollEnabled = […]

Storyboard和Simulator之间的XCodealignment/间隔?

所以我的故事板看起来像这样 但是,当我在iOS模拟器上打开,项目(扑克牌)是closures的权利 Storyboard的间距/alignment有什么问题? (这是最新的iOS 8和XCode 6)

减lessUICollectionViewCells之间的空间

目的 我试图减less我的UICollectionViewCells之间的空间 我试过了 我试着inheritanceUICollectionViewFlowLayout并覆盖这个方法: – (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect { NSArray *answer = [[super layoutAttributesForElementsInRect:rect] mutableCopy]; for(int i = 1; i < [answer count]; ++i) { UICollectionViewLayoutAttributes *currentLayoutAttributes = answer[i]; UICollectionViewLayoutAttributes *prevLayoutAttributes = answer[i – 1]; NSInteger maximumSpacing = 4; NSInteger origin = CGRectGetMaxX(prevLayoutAttributes.frame); if(origin + maximumSpacing + currentLayoutAttributes.frame.size.width < self.collectionViewContentSize.width) { CGRect frame = currentLayoutAttributes.frame; […]

在iOS上获取相对于地理北极的俯仰,俯仰和偏航?

我看到我可以从设备中检索CMAttitude ,从中可以读取我需要的3个值(俯仰,滚动和偏航)。 据我所知,这个CMAttitude对象由CoreMotionpipe理,它是一个传感器融合pipe理器,用于一起计算来自罗盘,陀螺仪和加速度计的正确结果(在Android上它是SensorManager类)。 所以我的问题是: 这些数值(俯仰,滚转和偏航)相对于磁北和重力? 如果以上是正确的,我怎么修改它给我相对于地理北方的结果呢? 如果一个设备(如iPhone 3GS)没有陀螺仪,我必须告诉经理,或者我可以告诉它给我的设备的态度基于它有传感器( acc + gyro + compas 或 acc + compas )

iOS设置为0时,UICollectionView间距仍然存在 – 如何设置单元格之间没有间距

我有一个简单的UICollectionView,我已经在InterfaceBuilder中设置了0的间距,但是当我用单元填充集合视图时,仍然有一些间距。 有没有什么特别的,并不是很明显,我需要做的,以实际上看到一个0间距collectionview单元格超出设置它有0间距? 谢谢。 编辑*一些代码: – (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath { UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath]; cell.backgroundColor = [UIColor clearColor]; UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(2, 2, cell.frame.size.width -4, cell.frame.size.height -4)]; lbl.backgroundColor = [UIColor clearColor]; lbl.font = [UIFont boldSystemFontOfSize:20]; lbl.text = [NSString stringWithFormat:@"$%0.0f", [[amountsArray objectAtIndex:indexPath.row] floatValue]]; lbl.textAlignment = NSTextAlignmentCenter; lbl.layer.borderWidth = 1; [cell addSubview:lbl]; […]

在iOS 8中更改UIBarButtonItems之间的间距

我有一个UINavigationItem在我的视图控制器 ,我试图减less我的两个RightBarButtonItems之间的间距。 这是我的一些代码: // Create two UIBarButtonItems let item1:UIBarButtonItem = UIBarButtonItem(customView: view1) let item2:UIBarButtonItem = UIBarButtonItem(customView: view2) var fixedSpace:UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, target: nil, action: nil) fixedSpace.width = -20.0 // Add the rightBarButtonItems on the navigation bar viewController.navigationItem.rightBarButtonItems = [item2, fixedSpace, item1] 可以看出,我正在使用FixedSpace UIBarButtonItem ,但由于某些原因,这不会改变间距。 我曾经想过子类UINavigationItem或UIBarButtonItem以便我可以相应地设置间距,但我似乎无法find任何方法,我可以重写以更改项目之间的间距。 任何有关如何解决这个问题的见解将不胜感激!