小编Swi*_*per的帖子

如何设置UICollectionView底部填充和滚动大小

你好,我有工作uicollectionview自定义布局和我issuesbottom paddingscrolling sizes.在下面picture你可以看到;

滚动时左上角的第一个单元总是保持在顶部(左侧单元格必须始终保持正确,现在没有问题,但滚动时顶部单元格必须滚动)

在此输入图像描述

我尝试viewDidLoad在下面的代码中设置但是dont工作

self.automaticallyAdjustsScrollViewInsets = false
self.collectionView.contentInset =  UIEdgeInsetsMake(20, 20, 120, 100);
Run Code Online (Sandbox Code Playgroud)

我的自定义collectionview layout文件

import UIKit

public var CELL_HEIGHT = CGFloat(22)

protocol CustomCollectionViewDelegateLayout: NSObjectProtocol {

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, widthForItemAtIndexPath indexPath: NSIndexPath) -> CGFloat
}

class CustomCollectionViewLayout: UICollectionViewLayout {

    // Used for calculating each cells CGRect on screen.
    // CGRect will define the Origin and Size of the cell.

    let …
Run Code Online (Sandbox Code Playgroud)

flowlayout ios uicollectionview swift

1
推荐指数
2
解决办法
3912
查看次数

通话电话操作无法在swift中运行

你好我对电话号码的按钮动作,但是当我使用它时不打电话,什么都没有显示.

我的代码如下.

  @IBAction func callPhone(sender: AnyObject) {
        UIApplication.shared().canOpenURL((NSURL(string: "tel://1234567890")! as URL))
    }
Run Code Online (Sandbox Code Playgroud)

谢谢 !

ibaction ios swift3

0
推荐指数
1
解决办法
2655
查看次数

如何在Swift 3中将CoreData Date转换为DateTime

我有CoreDatamyDate = date,Entity列并返回输出:

let mydate = coreDataValues[0].myDate!
print(mydate)

OUTPUT == 2017-02-01 12:45:40 +0000 
Run Code Online (Sandbox Code Playgroud)

我想转换mydatedatetime下面的例子;

2017-12-20-23-59-59
Run Code Online (Sandbox Code Playgroud)

我该怎么做 ?

string nsdate ios swift

0
推荐指数
1
解决办法
883
查看次数

check string是int或double,扩展名为swift 3

我有下面的字符串扩展名,但只有Int返回true ,我想返回true,仅适用于All,IntDouble值.

extension String  {
    var isnumberordouble : Bool {
        get{
            return self.rangeOfCharacter(from: CharacterSet.decimalDigits.inverted) == nil
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决?任何的想法 ?TY.

string swift

0
推荐指数
1
解决办法
1131
查看次数

如何在Swift中使用uppercaseString,lowercaseString

我有Strings,我想转换为uppercaseString,lowercaseStringonly letters.

我的琴弦;

let uppers  = " Hello*im ; + Upper+String "
let lowers  = " Hello*im ; + Lower+String "
print(uppers)
print(lowers)
Run Code Online (Sandbox Code Playgroud)

大写的输出看起来像这样

HELLOIMUPPERSTRING 
Run Code Online (Sandbox Code Playgroud)

谢谢 !

string ios swift

-2
推荐指数
1
解决办法
1059
查看次数

不推荐使用M_P:请使用'Double.pi'或'.pi'获取正确类型的值并避免在Swift 3.1中进行转换

使用Xcode 8.3.1将代码更新为Swift3.1时出现此错误

'M_PI'已弃用:请使用'Double.pi'或'.pi'获取正确类型的值并避免投射.

我的代码在下面,

let center     = containerShapeView.center
let startAngle = CGFloat(0.0)
let endAngle   = CGFloat(M_PI*2)
let radius     = containerShapeView.bounds.width * 0.21
Run Code Online (Sandbox Code Playgroud)

CGFloat(M_PI*2)行给出错误

我该如何解决?

swift swift3

-5
推荐指数
1
解决办法
5490
查看次数

标签 统计

swift ×5

ios ×4

string ×3

swift3 ×2

flowlayout ×1

ibaction ×1

nsdate ×1

uicollectionview ×1