- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在开发一个 iOS 应用程序以在 UITableView 中显示有关我的 facebook 好友的信息,但我遇到了问题。我使用带有 2 个 UILable(字段和描述)的自定义单元格:
在字段标签中,我设置了教育、工作等信息的类别。在描述标签中,我设置了相应的信息:
我的问题是标签不适合信息的大小,并截掉了一部分,如上所示。我厌倦了寻找解决方案,但一无所获。我已经尝试实现此答案中的代码 ( Adjust UILabel height depending on the text ) 但无法正常工作!
有什么建议吗?谢谢
最佳答案
UILabels 很好,但你为什么不使用 UITextView ?你可以在 textView 中使用\n,我可以看到你在标签中有大文本,根据你的文本大小来缩放字体大小并不是一个很好的决定。只需将 textView 添加到您的自定义单元格,禁用用户交互,将 editable 设置为 NO,您就完成了。您还可以使用此代码根据文本大小更改单元格高度:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//Load text in NSString which you want in Cell's textView.
NSString *cellText;
cellText = @"Insert your text here";
//define font for textView...
UIFont *cellFont = [UIFont fontWithName:@"Georgia" size:19.0];//change your font here
CGSize constraintSize = CGSizeMake(330.0f, MAXFLOAT);
CGSize labelSize_val = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:NSLineBreakByWordWrapping];
return labelSize_val.height + 20;
}
关于ios - UITableViewCell 中的 UILabel - 切断信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20587759/
我有一个自定义的 android 开关,它是这样定义的 和像这样的拇指选择器项
很不情愿地,我请求你们帮助我克服我的大脑卡住。我正在录制音频,但遇到一个问题,无法在不丢失一半的情况下获取录制的音频。 recAudioInput = recAudioContext.createMe
我正在学习本教程:http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-
我在 Swift 中使用 CGImageCreateWithImageInRect 在触摸位置创建部分图像的副本。 我的代码运行良好,除非用户触摸屏幕边缘并且矩形大小落在 View 框架之外。它不是返
我有一张正在创建的 map ,它的一部分似乎被切断或偏离了中心。我已经尝试添加 google.maps.event.triggerr(map, 'resize') 但它仍然被切断。有什么想法吗?
我有一个包含 5 列的数据框,所有列都包含数值。列代表时间步长。我有一个阈值,如果在规定时间内达到,就会阻止值发生变化。所以假设原始值是 [ 0 , 1.5, 2, 4, 1] 排列成一行,阈值是 2
有没有办法以编程方式关闭电源或关闭 Mac 上的 USB 端口? 最佳答案 我相信 USB 电源通常直接来自电源。它可能会通过主板或其他一些硬件将其与数据线结合起来,但我认为电压不会通过任何可编程电路
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
Android 上是否有接口(interface)或 API 或其他东西允许应用弹出电缆并停止从电缆供电或接收电源? 我查看了 USBDevice(包括 USBInterfaces),似乎找不到任何可
我知道我可以让 Navigation Header 在 actionBar 上滑动,但我只想将整个 Navigation drawer 向下移动,因为我想保持“后退”按钮和 actionBar 始终可
我有一个主要的 viewController A 和一个 UITabBar。我的问题是,当我滚动到最后一个单元格,然后在 UITableView 中单击单元格进入 viewController B,然
我有一个 Web 应用程序,在 Safari 中呈现时看起来不错,但浏览器不遵守打印媒体查询。在 Chrome 中,整个可打印区域看起来都不错,但在 Safari 中,它似乎只是可见内容的一些变体。
当使用带有 SeekBar View 的自定义 thumb drawable 时,拇指 drawable 在 View 的左右边缘被剪裁。 如何解决此问题? 最佳答案 您应该可以通过设置 paddin
我在文件中有一个字符串: git@github.com:myorg/Myrepo.git git@github.com:myorg/Mysecondrepo.git git@github.com:my
我有一个信息亭网页,其中加载了55px标题,而iFrame则占据了其下方的其余窗口。在iFrame中,我有一个页面可以懒惰地加载项目网格。我们一次加载50个项目,然后再加载50个,依此类推。每个项目都
我正在使用jquery form plugin它使用 jquery ajax 来完成大部分工作。我们有 jquery 1.7.2 我们使用它通过 ajax 向服务器发送表单,并返回指示成功的值或返回带
这是我的按钮元素: Let Me In, please! 这是 CSS: .btn-submit { margin: 0; padding: 0; border: none; font-family:
我的 CSS 样式表中有以下类: .errormsg { border:solid 1px Red; padding:5px 20px 5px 20px; margin:5px; co
我将 JWPlayer 与包含字幕的 HLS 文件一起使用。但是,当我在 iPhone 或其他 iOS 设备上播放此文件时,它会切断字幕: 有没有办法提高移动设备上字幕的高度?我的 HLS 文件是:
我有一个放置在 View 内部的 UIScrollView(界面生成器文档 .xib/.m/.h),但是由于 UITabBarController,UIScrollView 的下半部分被剪裁并且不显示
我是一名优秀的程序员,十分优秀!