小编sr1*_*116的帖子

数据包大小超过25152的ping失败?

当我尝试ping数据包大小> 25152时,我得到100%的数据包丢失.任何人都可以帮我解决为什么会发生???

ping -c 1 -s 25153 time.nist.gov

--- ntp.glb.nist.gov ping统计--- 1包传输,0接收,100%丢包,时间0ms

ping -c 1 -s 25152 time.nist.gov

PING ntp.glb.nist.gov(64.236.96.53)25152(25180)个字节的数据.来自dtc-nist01.ntp.aol.com的25160字节(64.236.96.53):icmp_req = 1 ttl = 45 time = 76.8 ms

--- ntp.glb.nist.gov ping statistics ---发送1个数据包,1个接收,0%丢包,时间0ms rtt min/avg/max/mdev = 76.887/76.887/76.887/0.000 ms

ping

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

NSLinkAttributeName无法在UITextView中使用

我正在开发一个IOS应用程序,我正在使用Swift.我想点击一下并点击该单词打开一些URL(现在是www.apple.com).

我使用以下代码但由于某种原因它不起作用.

func setDescription(description: NSAttributedString)
{
    let descriptionRect = CGRectMake(10, 50, self.bounds.size.width - 20, self.bounds.size.height-20)
    let descriptionView = UITextView(frame: descriptionRect)
    descriptionView.editable = false
    descriptionView.selectable = false
    descriptionView.attributedText = description
    descriptionView.delegate = self
    descriptionView.font = UIFont(name: "Helvetica", size: 14)
    NSLog("%@", descriptionView.attributedText)
    self.addSubview(descriptionView)
}

func textView(textView: UITextView, shouldInteractWithURL URL: NSURL, inRange characterRange: NSRange) -> Bool {
    NSLog("In text view delegate")
    return true;
}
Run Code Online (Sandbox Code Playgroud)

下面的代码片段接受一个字符串,并形成属性字符串,前5个字符包含NSLinkNameAttribute.然后我调用了setDescription函数将此属性字符串添加到TextView.

            let mutableAttrString = NSMutableAttributedString(string: attrString1)
            let linkURL = NSURL(string: "http://www.apple.com")
            mutableAttrString.addAttribute(NSLinkAttributeName,value: linkURL!,range: NSMakeRange(0, 5))
            wordDetailView.setDescription(mutableAttrString)
Run Code Online (Sandbox Code Playgroud)

当我点击具有链接属性的单词时,textview委托甚至没有被调用!!!! 有人可以帮我解决它为什么不工作以及如何使它工作.

谢谢.

iphone uitextview nsattributedstring ios swift

4
推荐指数
1
解决办法
4162
查看次数

标签 统计

ios ×1

iphone ×1

nsattributedstring ×1

ping ×1

swift ×1

uitextview ×1