以下是
在if()部分,我希望禁用selectedSegmentIndex==0并在button.hidden=YES时启用。
UISegmentedControl
的代码。UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects: [UIImage imageNamed:@"down.png"], [UIImage imageNamed:@"dList.png"], nil]];
[segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];
segmentedControl.frame = CGRectMake(0, 0, 90, 65);
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.momentary = YES;
UIBarButtonItem *segmentBarItem = [[UIBarButtonItem alloc] initWithCustomView:segmentedControl];
[segmentedControl release];
self.navigationItem.rightBarButtonItem = segmentBarItem;
[segmentBarItem release];
并且
- (void)segmentAction:(id)sender{
if([sender selectedSegmentIndex] == 0)
{
button.hidden=NO;
}
else
{
[self dListMethod ];
}
}
在if()部分,我希望禁用selectedSegmentIndex==0并在button.hidden=YES时启用。
button.hidden = NO
的情况下执行if([sender selectedSegmentIndex] == 0)
这一行代码吗? - EmptyStack