我在故事板中添加了一堆WKInterfaceLabel,在InterfaceController.h中将它们添加为IBOutlets,并使用SetText方法在它们上设置一些文本。但是,我对视图没有任何改变。控制台为每个标签提供消息“接口描述中的未知属性”。我该如何解决这个问题?
在InterfaceController.h中,我按如下方式定义标签:
Server Version: 76
TWS Time at connection:20150508 13:42:02 EST
bid 111.42
ask 111.5
bid 111.43
bid 111.44
bid 111.42
bid 111.38
bid 111.32
ask 111.44
All done
在InterfaceController.m中,我按如下方式设置文本:
IBOutlet WKInterfaceLabel *hdate;
答案 0 :(得分:3)
由于正确的答案在问题的评论中,我将在此再次发布:
您只能使用
在.h文件中创建IBOutletsplice
在括号中,我必须将它们设置为属性。
(致用户3261697)
答案 1 :(得分:-1)
更改
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0033)http://demo.jq22.com/jquery-win7/ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<SCRIPT src="jquery-win7_files/jq.js"></SCRIPT>
<SCRIPT>
(function($) {
$.fn.dom = function() { return this[0] ;}
})($) ;
function Pointer(x, y) {
this.x = x ;
this.y = y ;
}
function Position(left, top) {
this.left = left ;
this.top = top ;
}
function Direction(horizontal, vertical) {
this.horizontal = horizontal ;
this.vertical = vertical ;
}
$(function() {
var clientWidth = document.documentElement.clientWidth || document.body.clientWidth ;
var clientHeight = document.documentElement.clientHeight || document.body.clientHeight ;
$(".desktop_bg").width(clientWidth).height(clientHeight) ;
var oldPointer = new Pointer() ;
var oldPosition = new Position() ;
var direction = new Direction() ;
var div = $("<div></div>").css({
background : "blue",
position : "absolute",
opacity : "0.2"
}).appendTo($("body")) ;
var isDown = false ;
$(".desktop").mousedown(function(e) {
e.preventDefault() ;
if(div.dom().setCapture) {
div.dom().setCapture(true) ;
}
$("ul li").css("border", "1px solid transparent") ;
isDown = true ;
oldPointer.x = e.clientX ;
oldPointer.y = e.clientY ;
oldPosition.left = e.clientX,
oldPosition.top = e.clientY
div.css({
left : e.clientX,
top : e.clientY
}) ;
}) ;
div.extend({
checkC : function() {
var $this = this ;
$("ul li").each(function() {
if($this.offset().left + $this.width() > $(this).offset().left &&
$this.offset().left < $(this).offset().left + $(this).width()
&& $this.offset().top + $this.height() > $(this).offset().top
&& $this.offset().top < $(this).offset().top + $(this).height()) {
$(this).css("border", "1px solid #90bedb") ;
} else {
$(this).css("border", "1px solid transparent") ;
}
}) ;
}
}) ;
$(".desktop").mousemove(function(e) {
if(!isDown) return isDown ;
if(e.clientX > oldPointer.x) {
direction.horizontal = "Right" ;
} else if(e.clientX < oldPointer.x) {
direction.horizontal = "Left" ;
} else {
direction.horizontal = "" ;
}
if(e.clientY > oldPointer.y) {
direction.vertical = "Down" ;
} else if(e.clientY < oldPointer.y) {
direction.vertical = "Up" ;
} else {
direction.vertical = "" ;
}
var directionOperation = {
LeftUp : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : Math.abs(e.clientY - oldPointer.y),
top : oldPosition.top - Math.abs(e.clientY - oldPointer.y) ,
left : oldPosition.left - Math.abs(e.clientX - oldPointer.x)
}) ;
},
LeftDown : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : Math.abs(e.clientY - oldPointer.y),
left : oldPosition.left - Math.abs(e.clientX - oldPointer.x)
}) ;
},
Down : function() {
div.css({
width : 1,
height : Math.abs(e.clientY - oldPointer.y)
}) ;
},
Up : function() {
div.css({
width : 1,
height : Math.abs(e.clientY - oldPointer.y),
top : oldPosition.top - Math.abs(e.clientY - oldPointer.y)
}) ;
},
Right : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : 1
}) ;
},
Left : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : 1,
left : oldPosition.left - Math.abs(e.clientX - oldPointer.x)
}) ;
},
RightDown : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : Math.abs(e.clientY - oldPointer.y)
}) ;
},
RightUp : function() {
div.css({
width : Math.abs(e.clientX - oldPointer.x),
height : Math.abs(e.clientY - oldPointer.y),
top : oldPosition.top - Math.abs(e.clientY - oldPointer.y)
}) ;
}
}
directionOperation[direction.horizontal + direction.vertical]() ;
div.checkC() ;
}) ;
$(document).mouseup(function() {
if(!isDown) return isDown ;
isDown = false ;
div.width(0).height(0) ;
if(div.dom().releaseCapture) {
div.dom().releaseCapture(true) ;
}
}) ;
}) ;
</SCRIPT>
<STYLE>
body{ overflow: hidden; padding: 0; margin: 0; background-color: #333333; }
ul {
list-style:none;
padding:0;
margin:0;
}
ul li {
border:1px solid transparent ;
padding:5px;
width:65px;
height:65px;
margin:10px;
text-align:center;
font:14px/16px "微软雅黑" ;
color:#fff;
border-radius:4px;
}
.desktop {
position:absolute;
left:0;
top:0;
}
img {
border:none;
}
</STYLE>
</head>
<BODY>
<DIV class="desktop">
<UL>
<LI><A href="http://www.jq22.com/" target="_blank"><IMG width="65" height="65"
src="jquery-win7_files/a1.png"></A></LI>
<LI><A href="http://www.jq22.com/" target="_blank"><IMG width="65" height="65"
src="jquery-win7_files/a2.png"></A></LI>
<LI><A href="http://www.jq22.com/" target="_blank"><IMG width="65" height="65"
src="jquery-win7_files/a3.png"></A></LI>
<LI><A href="http://www.jq22.com/" target="_blank"><IMG width="65" height="65"
src="jquery-win7_files/a4.png"></A></LI>
<LI><A href="http://www.jq22.com/" target="_blank"><IMG width="65" height="65"
src="jquery-win7_files/a5.png"></A></LI>
</UL>
</DIV>
</BODY>
</HTML>
要
IBOutlet
或者将标签重新连接到视图。
就我而言,它成功运行。