-(voID)setupDocslabel:(NSMutableArray *)documents{ self.ldocumentos.frame = CGRectMake(self.ldocumentos.frame.origin.x,kFirstLabelYposition+actualLabelYPos,self.ldocumentos.frame.size.wIDth,ldocumentos.frame.size.height); self.documentos.frame = CGRectMake(self.documentos.frame.origin.x,self.documentos.frame.size.wIDth,self.documentos.frame.size.height); actualLabelYPos +=20.0; for (Docinformation *doc in documents) { Nsstring *textLabel = [doc.documentDescription stringByAppendingString:@" :"]; UIFont *lblFont = ldocumentos.Font; CGSize sizeFont = [textLabel sizeWithFont:lblFont forWIDth:120.0 lineBreakMode:NSlineBreakByTruncatingTail]; UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(ldocumentos.frame.origin.x+20,sizeFont.wIDth,sizeFont.height)] retain]; label.text = textLabel; [label setFont:lblFont]; [label setTextcolor:ldocumentos.textcolor]; [label setBackgroundcolor:[UIcolor clearcolor]]; //[label setlineBreakMode:NSlineBreakByTruncatingTail]; Nsstring *textDoc = doc.cdgodocum; UIFont *lblFontDoc = documentos.Font; CGSize sizeFontDoc = [textDoc sizeWithFont:lblFontDoc]; UILabel *labelDoc = [[[UILabel alloc] initWithFrame:CGRectMake(label.frame.origin.x+label.frame.size.wIDth+20,sizeFontDoc.wIDth,ldocumentos.frame.size.height)] retain]; labelDoc.text = textDoc; [labelDoc setFont:lblFontDoc]; [labelDoc setTextcolor:ldocumentos.textcolor]; [labelDoc setBackgroundcolor:[UIcolor clearcolor]]; [self.scrollVIEw addSubvIEw:label]; [self.scrollVIEw addSubvIEw:labelDoc]; [label release]; [labelDoc release]; actualLabelYPos+=20.0; } //[self.vIEw setNeedsdisplay]; //[self.vIEw setNeedsLayout];}
新标签很好地添加到scrollVIEw,但self.ldocumentos(.xib的IBOutlet)不会改变他的位置.
谢谢您的帮助!!
解决方法 我已经解决了,问题是.xib在file Inspector中启用了Use autoLayout. 总结以上是内存溢出为你收集整理的ios – .xib的UILabel属性的setFrame不起作用全部内容,希望文章能够帮你解决ios – .xib的UILabel属性的setFrame不起作用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)