我有一个段控制。当我单击一个段时,我想显示 FooterView,而当我单击第二个段时,我想隐藏 FooterView。
问问题
83 次
1 回答
1
NSArray *itemArray = [NSArray arrayWithObjects: @"One", @"Two", nil];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:itemArray];
segmentedControl.frame = CGRectMake(35, 200, 250, 50);
segmentedControl.segmentedControlStyle = UISegmentedControlStylePlain;
segmentedControl.selectedSegmentIndex = 1;
[segmentedControl addTarget:self action:@selector(ButtonPress:) forControlEvents:UIControlEventChanged];
[self.view addSubview:segmentedControl];
[segmentedControl release];
- (void)ButtonPress:(id)sender
{
if([sender selectedSegmentIndex] == 0)
{
//put your code as per condition
footerView.hidden = FALSE;
} else {
//put your code as per condition
footerView.hidden = TRUE;
}
}
于 2013-09-09T10:39:59.563 回答