我对iphone开发非常陌生,我想减小分组表格视图中某个部分的大小,即减小该部分的宽度。如何实施呢? 提前谢谢
答案 0 :(得分:2)
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return kHeightForHeaderInSection;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
// wrapperView - by default has the width of the table, you can change the height
// with the heightForHeaderInSection method
UIView *aView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
// your real section view: a label, a uiview, whatever
CGRect myFrame; // create your own frame
myFrame.origin = CGPointMake(10, 0);
myFrame.size = CGSizeMake(tableView.bounds.size.width-10,kHeightForHeaderInSection);
UILabel *label = [[[UILabel alloc] initWithFrame:myFrame] autorelease];
label.text = @"myText"
[aView addSubview:label];
return aView;
}
答案 1 :(得分:0)
您好添加此UITableviewdelegate方法
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return height;
}
答案 2 :(得分:0)
这是一个非常简单的解决方案......
@interface MyController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UITableview *myTableview;
右键单击“UITableViewDelegate”和“UITableViewDataSource”
n实现所有代表....你会在那里找到所有类型的调整....天气你想要改变或调整部分或行的高度或宽度......或多少部分或多少行在一个部分,你想要.... 它的简单n自动调用....问候