iOS中tableViewCell文字居中显示
来源:互联网 发布:丙烯酸和js哪个好 编辑:程序博客网 时间:2024/05/23 20:16
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *indentify = @"ReportCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentify]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentify]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.textLabel.textAlignment = NSTextAlignmentCenter;//文字居中 cell.textLabel.text = @"广告"; return cell;}
tableView单元格居中显示:
cell.textLabel.textAlignment =NSTextAlignmentCenter;//文字居中
注意:cell的类型需要是 UITableViewCellStyleDefault。
类型如下:
typedef NS_ENUM(NSInteger, UITableViewCellStyle) {
UITableViewCellStyleDefault,// Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x)
UITableViewCellStyleValue1,// Left aligned label on left and right aligned label on right with blue text (Used in Settings)
UITableViewCellStyleValue2,// Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts)
UITableViewCellStyleSubtitle// Left aligned label on top and left aligned label on bottom with gray text (Used in iPod).
}; // available in iPhone OS 3.0
- iOS中tableViewCell文字居中显示
- iOS之ios8中TableViewCell中的短线不能居中问题
- iOS 开发中tabBarItem不显示文字,只显示图片,且图片居中显示
- css div中文字垂直居中显示
- 文字居中显示
- RaidoButton文字居中显示
- ios 开发中,如何设置 uitabbar 里面 tabbaritem 不显示文字,只显示图片,图片垂直居中?
- 让文字在div中垂直居中显示
- RadioButton在低版本中文字居中显示的问题
- RadioButton在低版本中文字居中显示的问题
- Accordion头部文字居中显示
- TextView文字+drawableLeft居中显示
- 设TextView文字居中显示
- tabhost tabwidget文字居中显示
- 关于spinner文字居中显示
- Android TextView 文字居中显示
- 文本框文字居中编辑 显示
- html文字居中对齐显示
- 【jzoj4832】【高维宇宙】【网络流】【二分图匹配】
- ZWAVE Alarm Report Command
- 【jzoj4833】【Mahjong】【搜索】
- 深入理解黑客攻击-直接修改可执行文件
- 【jzoj4840】【小W砍大树】【模拟】
- iOS中tableViewCell文字居中显示
- 【jzoj4841】【平衡的子集】【搜索】
- HttpGetDemo 架包 http协议Get提交
- android 自定义下拉刷新上拉加载控件(SwipeRefreshLayout + recyclerView)
- CVI减少CPU占用率
- 怎么在pycharm中让按照任意的格式折叠代码块,比如让每个for循环都可以折叠起来
- Android中Timer计时器详解
- BuildConfig.debug always false
- java中简单的截取分割字符串{csdn老六}