草庐IT

text_cell_render

全部标签

ios - Xcode 8 iOS 10 UITableView 问题 : UIImageView added from storyboard is rendering until table is scrolled

我的Storyboard中有表格View,它一直工作到Xcode7.3,将Xcode更新到8后,在您滚动或显式调用reloadData之前,添加到tableviewcell中的ImageView不会第一次呈现。ImageView是从Storyboard添加的。滚动后-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{ALContactCell*contactCell;switch(indexPath.section){case0:{//Cell

ios - UILabel TEXT 的两种颜色

我想为UILabel的文本设置两种颜色。我试过TTTRegexAttributedLabel,但它抛出未知类型错误。我也试过下面的代码。但它在settext处崩溃。NSMutableAttributedString*str=[[NSMutableAttributedStringalloc]initWithString:@"Hello.Thatisatestattributedstring."];[straddAttribute:@"Hello"value:[UIColoryellowColor]range:NSMakeRange(3,5)];[straddAttribute:@"Tha

ios - swift 3 : How to center horizontally the last row of cells in a UICollectionView with only one section?

我正在使用只有一个部分的UICollectionView。这是一些可视化:[xxx][xxx][xx]如果UICollectionView的最后一行没有填充所有3个单元格,我想像这样将这些单元格居中:[xxx][xxx][xx]我尝试从以下地方实现解决方案:HowtocenterhorizontallyUICollectionViewCells?HowtocenteralignthecellsofaUICollectionView?但是,解决方案会移动所有单元格,如果最后一行不包含X个单元格,我只想移动最后一行,因为我只有一个部分。我知道如何设置插图,但我不知道如何通过只有一个部分并尝

iphone - 如何在 Core Text Programming 中设置字体大小和名称?

下面是我的代码崩溃了CTFramesetterRefframesetter=CTFramesetterCreateWithAttributedString(currentText);我正在尝试设置字体,请帮帮我,谢谢。+(void)drawText:(NSString*)textToDrawinFrame:(CGRect)frameRect{//CFStringRefstringRef=(__bridgeCFStringRef)textToDraw;//PreparethetextusingaCoreTextFramesetterNSAttributedString*stringRef

iphone - objective-c/iOS : setting status text in async function is slow

在我的应用程序中,我正在与远程服务器进行一些通信,由于这可能很慢,我认为异步运行该代码是个好主意。我在传递给dispatch_async的block中有我的通信代码。此代码进行通信,完成后设置标签文本。最后一部分是问题所在。文本已设置,但它会在几秒钟的延迟后出现。这是我的代码。-(void)doNetworkingTask{dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{//Slownetworktaskgoeshere.//Slownetworktaskdone,notifyt

ios - 设置Dynamic Cell的Table View Content height为table view height constraints ios

我有tableview(A)的每个自定义单元格都有tableview(B)和动态表格View单元格。在tableview(A)cellForRowAtIndex。-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{MainMessageTVCell*cell=[tableViewdequeueReusableCellWithIdentifier:@"MsgMainCell"];cell.selectionStyle=UITableViewCel

iphone - 将 UIView 添加到 cell.contentView 时出现 UITableView 性能问题

在我的UITableViewCells上使用某些subview时,我遇到了性能问题。在我继续滚动之后,它最终开始变得非常慢。我做的第一步是为每个单元格创建一个通用的UIView,本质上这是创建一个白色单元格,在带有阴影的单元格上具有圆形效果。这方面的表现似乎很正常,所以我不认为这是罪魁祸首。这是我用来执行此操作的代码:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*NewsCellIdentifer=@"New

ios - 如何知道 UIButton titlerable.text 是否改变

我只想知道如何在按钮标题更改时触发某些功能?我尝试使用此命令但没有任何效果:[buttonaddTarget:selfaction:@selector(function:)forControl:UIControlEventValueChange]; 最佳答案 你可以在你的viewcontroller中使用一个观察者,它有一个按钮的导出:首先添加观察者(以viewDidLoad为例)[self.buttonaddObserver:selfforKeyPath:@"titleLabel.text"options:NSKeyValueOb

ios - 在 XCODE 中使用我自己的 Cell 对象

我已经成功创建了我的“单元格”对象(基于UITableViewCell),并在通过cellForRowAtIndexPath构建表格时成功地使用了它。但是,如何解构我在didSelectRowAtIndexPath中所做的事情?我目前收到错误“Incompatiblepointertypesinitializing'MyCell*__strong'withanexpressionoftype'UITableViewCell'”鉴于我的对象(MyCell)基于UITableViewCell,我不明白为什么会出现此错误。你能帮我理解我做错了什么吗。我的替代方法是为单元格中的两个标签中的每一

objective-c - Objective-C : How to create custom/static table view cells via code

我正在尝试使用代码(不带Nib)创建3个表格View单元格。我在使代码正常工作时遇到了一些麻烦。我想我没有得到正确的方法。任何人都可以建议我前进的正确方法吗?对此的任何帮助将不胜感激!谢谢!郑和我的代码片段如下:-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{//Returnthenumberofsections.return1;}-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{//R