如何使用Swift添加Table View搜索框

如何使用Swift添加Table View搜索框,第1张

在Xcode中,选择 File\New\Project… 创建一个新项目。选择 Single View Application 点 Next 。将项目命名为 CandySearch 确保 Language 设置为 Swift 并且 Devices 设置为 iPhone 。点击完成,选择你想储存的位置,然后点击 Create 。

首先将默认的文件清理掉,这样你就可以真正的从头开始。在 Project Navigator中,选择 ViewController.swift ,右键点击,选择删除,然后选择 Move to Trash 。然后打开 Main.storyboard ,选择唯一的一个view controller然后删掉他。现在你有一个空的storyboard,可以在你的应用中添加主屏幕了。

- (void)addDottedLineFromImageView:(UIView *)bView {

    bView.layer.cornerRadius = 4

    CAShapeLayer*borderLayer =  [[CAShapeLayeralloc]init]

    borderLayer.bounds= bView.bounds

    borderLayer.position=CGPointMake(bView.centerX, bView.centerY)

    borderLayer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0,0, 68, 68) cornerRadius:4].CGPath

    borderLayer.lineWidth=1

    //虚线边框---小边框的长度

    borderLayer.lineDashPattern = @[@6,@4]//前边是虚线的长度,后边是虚线之间空隙的长度

    borderLayer.lineDashPhase=0.1

    borderLayer.fillColor=UIColor.clearColor.CGColor

    borderLayer.strokeColor=BSHexColor(0xA6A8AB).CGColor

    [bView.layeraddSublayer:borderLayer]

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11436927.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存