use*_*401 3 iphone xcode objective-c uitableview ios
我试图添加一个UITableView类似于附加图像上的固定透明标题(LHR-SYD/372结果).这是xcode/ios中的"内置"组件还是如何完成的?

使用这些方法,
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;
Run Code Online (Sandbox Code Playgroud)
以上设置视图的方法.
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
Run Code Online (Sandbox Code Playgroud)
以上设置标题的方法.看到这一个,
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UILabel *lbl = [[[UILabel alloc] init] autorelease];
lbl.textAlignment = UITextAlignmentLeft;
lbl.text=@"LHR-SYD / 372 Results";
return lbl;
}
Run Code Online (Sandbox Code Playgroud)
通过使用上述方法,您可以向标题视图添加不同的对象.
(要么)
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return @"LHR-SYD / 372 Results";
}
Run Code Online (Sandbox Code Playgroud)
这个你的要求我是这么认为的.
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 30;
}
Run Code Online (Sandbox Code Playgroud)
您可以使用此代码设置标题视图的高度
| 归档时间: |
|
| 查看次数: |
5008 次 |
| 最近记录: |