I am an iOS development newbie. I have a settings screen which is a UITableView. I want to add some explanation to it. I am using the following code to do it, but it skews up the text completely. Any idea what I am doing wrong?
UILabel *subjectLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0, 300, 175)];
subjectLabel.font = [UIFont systemFontOfSize:16.0];
subjectLabel.numberOfLines = 0;
subjectLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(10.0)];
subjectLabel.backgroundColor = [UIColor clearColor];
//bodyLabel.textAlignment = UITextAlignmentLeft;
subjectLabel.text = @"mytext";
settingTableView = [[[UITableView alloc] initWithFrame:CGRectMake(0,0, 320, 370) style:UITableViewStyleGrouped] autorelease];
settingTableView.dataSource = self;
settingTableView.delegate = self;
[settingTableView addSubview:subjectLabel];
[self.view addSubview:settingTableView];
A
tableViewHeaderis aUIViewwhich is set as thetableViewHeaderproperty of a tableView. If you want to have aUILabelin a header view, make a separateUIView(either in code, or in a nib), and set it as thetableView.tableHeaderViewproperty. More information can be found here: TableView Reference. Hope that helps!