project_files/HedgewarsMobile/Classes/SchemeWeaponConfigViewController.m
changeset 6636 4450e746dc34
parent 6634 e00762923086
child 6700 e04da46ee43c
equal deleted inserted replaced
6634:e00762923086 6636:4450e746dc34
    89         [array release];
    89         [array release];
    90         controller.segmentedControlStyle = UISegmentedControlStyleBar;
    90         controller.segmentedControlStyle = UISegmentedControlStyleBar;
    91         controller.tintColor = [UIColor lightGrayColor];
    91         controller.tintColor = [UIColor lightGrayColor];
    92         controller.selectedSegmentIndex = 0;
    92         controller.selectedSegmentIndex = 0;
    93         self.topControl = controller;
    93         self.topControl = controller;
    94         [controller addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
       
    95         [controller release];
    94         [controller release];
    96     }
    95     }
    97     return topControl;
    96     return topControl;
    98 }
    97 }
    99 
    98 
   129     [aTableView release];
   128     [aTableView release];
   130     [self.view addSubview:self.tableView];
   129     [self.view addSubview:self.tableView];
   131 
   130 
   132     [super viewDidLoad];
   131     [super viewDidLoad];
   133     controllerInstance = self;
   132     controllerInstance = self;
       
   133 }
       
   134 
       
   135 // this is a workaround to keep the uisegmented control visible
       
   136 -(void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
       
   137     [self.tableView reloadData];
   134 }
   138 }
   135 
   139 
   136 #pragma mark -
   140 #pragma mark -
   137 #pragma mark Table view data source
   141 #pragma mark Table view data source
   138 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   142 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   208 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
   212 -(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
   209     return 50.0;
   213     return 50.0;
   210 }
   214 }
   211 
   215 
   212 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
   216 -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
   213     UIView *theView = [[[UIView alloc] init] autorelease];
   217     UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)];
       
   218     theView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
   214     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
   219     self.topControl.frame = CGRectMake(0, 0, self.view.frame.size.width * 80/100, 30);
   215     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
   220     self.topControl.center = CGPointMake(self.view.frame.size.width/2, 24);
       
   221     [self.topControl addTarget:self.tableView action:@selector(reloadData) forControlEvents:UIControlEventValueChanged];
   216     [theView addSubview:self.topControl];
   222     [theView addSubview:self.topControl];
   217     return theView;
   223     return [theView autorelease];
   218 }
   224 }
   219 
   225 
   220 #pragma mark -
   226 #pragma mark -
   221 #pragma mark Table view delegate
   227 #pragma mark Table view delegate
   222 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   228 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {