我在将新添加的图像加载到protocol ClickableCurves {
func clickedOnCurve(index: Int)
}
class MySheet: NSWindowController, ClickableCurves {
private let lineColorCount = 16
func clickedOnCurve(index: Int) {
Swift.print("came back as \(index)")
}
override func windowDidLoad() {
super.windowDidLoad()
(curveView as! DefaultCurveAttrView).delegate = self
}
@IBOutlet weak var curveView: NSView!
}
class DefaultCurveAttrView: NSView {
var delegate: ClickableCurves? = nil
override func drawRect(dirtyRect: NSRect) {
super.drawRect(dirtyRect)
}
override func mouseDown(theEvent: NSEvent) {
let frameRelWindow = self.convertRect(bounds, toView: nil)
let x = theEvent.locationInWindow.x - frameRelWindow.origin.x
let y = theEvent.locationInWindow.y - frameRelWindow.origin.y
let xm = bounds.width / 10
let dy = bounds.height / CGFloat(lineColorCount + 1)
var yc: CGFloat = dy / 2
if x >= xm && x <= 9 * xm {
for i in 1 ... lineColorCount {
yc += dy
if yc > y || i == lineColorCount {
if delegate != nil {
delegate!.clickedOnCurve(i - 1)
}
break
}
}
}
}
}
内的Image标记时面临一个奇怪的问题。该代码适用于Chrome,但IE不支持图像加载。
当用户将图像上传到服务器位置时,我获取图像的位置并将其传递给ng-repeat
,但似乎这不适用于Internet Explorer。我正在获取如下所示的图像,但是当我刷新页面时,它从服务器位置加载图像时没有任何问题。我是一个单页面应用程序,所以我无法刷新页面。请有人帮忙解决这个问题。提前谢谢。
Html代码:
ng-src
IE控制台参考:
<div id="contactInfoContainer" ng-repeat="contacts in contactData | filter: contactFilter | orderBy:orderByField :!reverseSort |orderBy:'DisplayOrder' | emptyToEnd:'DisplayOrder' ">
<div class="container1">
<div class="contactImgContainer image-cropper-main" >
<img id="contactImage" ng-src="{{ contacts.ProfileImage.Url || '../Images/person.png' }}" class="contactImg" width="65px" heigth="65px"/>
</div>
</div>
**图片错误**