Tag: 标签

UIViewTableCell中的layoutSubviews不起作用

我有一个类PostListTableCell,inheritanceUITableViewCell,它用作我的自定义单元格在UITableView中。 我需要调整单元格中的一些标签,所以我打电话给下面的方法 – (void)layoutSubviews { [super layoutSubviews]; [_titleLabel sizeToFit]; } 但问题是,加载UITableView时,_titleLabel不会resize: 但是,当我点击这个单元格并select它,标题确实resize: 以下是加载数据的代码: – (PostListTableCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *PostListTableCellIdentifier = @"PostListTableCell"; PostListTableCell *cell = (PostListTableCell*) [tableView dequeueReusableCellWithIdentifier:PostListTableCellIdentifier]; if (cell == nil) { cell = [[PostListTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:PostListTableCellIdentifier]; } Post *post = (Post*)_posts[indexPath.row]; [cell loadPost:post]; return cell; } 谁能帮忙?

用animation改变标签框的大小

我想知道是否有一种方法来改变一个标签的框架的宽度(而不是fontSize或什么)与一个stream畅的animation。 我已经尝试了以下,显然没有工作: _myLabel.frame = CGRectMake(139,193,42,21); [UIView animateWithDuration:1 animations:^ { _myLabel.frame = CGRectMake(139, 193, 100, 21); } completion:^(BOOL finished) { }]; 所以运行这个代码之后基本上发生了什么,它改变了预期的宽度,但没有任何animation。 有任何想法吗?

我怎样才能保存这个数组的图像?

我对编程非常陌生,于是我跳进了一个项目(我知道这不是最聪明的事情,但我正在学习)。 我正在写的应用程序有10个UIImageViews显示用户相机胶卷的图片。 我正在使用的代码需要每个UIImageView有标签。 我目前正在使用NSData保存数组图像,它的工作原理,但我不能再使用这种方法,因为NSData不支持使用标签。 我也不能使用NSUserDefaults,因为我不能保存图像到plist。 这是我如何尝试做到这一点(使用NSData方法,它的工作原理,但我必须编辑这个,以便我的标签工作。) 这是我现在的代码: – (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { if (imageView.image == nil) { imageView.image = img; [self.array addObject:imageView.image]; [picker dismissModalViewControllerAnimated:YES]; [self.popover dismissPopoverAnimated:YES]; return; } if (imageView2.image == nil) { imageView2.image = img; NSLog(@"The image is a %@", imageView); [self.array addObject:imageView2.image]; [picker dismissModalViewControllerAnimated:YES]; [self.popover dismissPopoverAnimated:YES]; return; } … – […]

左值作为赋值的左操作数

我想分配suitSize scrollButton我做错了什么? UIView *scrollButton = [suitScrollView viewWithTag:1]; CGSize suitSize =CGSizeMake(10.0f,10.0f); (UIButton *)scrollButton.frame.size=suitSize;

Swift iOS – 标记集合视图

我正在写我的第一个iOS应用程序,我想回答什么是最好的解决scheme,使这个? 这是简单的标签收集。 我已经浏览了互联网,但是我什么都没有find。 我认为最好的方法是让我自己的button结构也许? 这是我想要达到的:

在CPTBarPlot上定位标签(Core-Plot)

我正在尝试使用Core-Plot更改条形图中标签的默认位置。 我正在使用这个方法: -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx; 我回来了: return textLayer = [[CPTTextLayer alloc] initWithText:@"2222" style:textStyle]; 我得到这个结果: 但是我想要显示如下: 任何想法? 我试图find关于文件的答案,但我已经不可能了。

dynamicUILabel截断文本

我使用这个答案中提供的代码来创build一个dynamic标签,它大部分工作。 但是,每当标签文本超过94个字符的长度,它会被截断,省略号被添加。 还有一个更奇怪的事情是,如果我添加更多的字符到string,他们显示,但最后2行仍然被截断。 例如。 string: this is a very very long string with lots of words to test the dynamic bubble sizing one two three. 如下所示: this is a very very long string with lots of words to test the dynamic bubble sizing one tw… 但是,当我在标签中再次使用相同的句子来加倍string时,它会显示更多的te文本,但仍会截断它。 例如。 string: this is a very very long string […]

IOS:用标签值更改UIImageView

我有20 UIImageView,我想改变他们的形象; 但是我不想创build20个IBOutlet,我想用标签值来改变图像; 我在界面生成器中设置标签值,之后? 如果我想在Imageview编号15改变图像? 我能怎么做?

MBProgressHUD在多行显示标签文本

嗨,我的iPad屏幕上有一个MBProgressHUD。 工作得很好。 但是我想把标签改成三行显示。像这样 self.hud = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; self.hud.frame = CGRectMake(0, 0, 120, 143); [self.navigationController.view addSubview:self.hud]; self.hud.delegate = self; self.hud.mode = MBProgressHUDModeAnnularDeterminate; NSString *strloadingText = [NSString stringWithFormat:@"Loading Data.\r Please Wait.\r 1-2 Minutes"]; NSLog(@"the loading text will be %@",strloadingText); self.hud.labelText = strloadingText; [self.hud show:YES]; 所以我想要3行中的标签 加载数据中。 请稍候 1-2分钟 或者我可以分配一个图像的HUD? 所有这些都应该在labeltext中。 但是我只有一条线。 我怎样才能做到这一点? 如果您需要更多信息,请询问。谢谢。

如何在标签视图控制器故事板应用程序中添加更多选项卡?

可能重复: Xcode 4.2选项卡式应用程序 – 添加新的选项卡视图 我是新来的iPhone应用程序,我跟着以下教程开发使用故事板的选项卡视图应用程序: 它工作正常。感谢作者。 🙂 现在, 我想添加几个选项卡到主视图(默认,其2个选项卡;我想3或4)。 我该怎么做?