sujay
sujay

Reputation: 1845

reducing size of the section in tableview

i am very much new to iphone development ,I wanted to reduce the size of a section in the grouped table view i.e reducing the width of the section . how can it be implemented thanks in advance

Upvotes: 0

Views: 510

Answers (3)

namannam
namannam

Reputation: 169

its a very simple soln ...

@interface MyController : UIViewController <UITableViewDelegate, UITableViewDataSource>
{
IBOutlet UITableview *myTableview;

just right click on "UITableViewDelegate" and "UITableViewDataSource"

n implement all the delegates....u will find all types of adjustment over there....weather u want to change or adjust height or width of section or row ...or how many section or how many rows in a section do u want.... its simple n called automatically.... regards

Upvotes: 0

marcio
marcio

Reputation: 2729

- (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;
    }

Upvotes: 2

Arvind
Arvind

Reputation: 543

Hi add this UITableviewdelegate method

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return height;
}

Upvotes: 0

Related Questions