Since the UISegmentedControl cannot be customized in IOS 7 , and since my project deserves a certain degree of customization, i decided to create two UIButtons Manually, with a bool variable to tell which button is clicked, and the reload a tableView :
- (IBAction)pastFun:(id)sender {
statusClicked = FALSE;
NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"PAST"];
[commentString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [commentString length])];
[pastBut setAttributedTitle:commentString forState:UIControlStateNormal];
[self.tableView reloadData];
}
- (IBAction)pendingFun:(id)sender {
statusClicked = TRUE;
[self.tableView reloadData];
}
in pastFun, i added the following block in order to underline the button when selected, and it works :
NSMutableAttributedString *commentString = [[NSMutableAttributedString alloc] initWithString:@"PAST"];
[commentString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [commentString length])];
[pastBut setAttributedTitle:commentString forState:UIControlStateNormal];
What i want to do is, when the pendingFun is called ( next button is clicked), remove the underline from the first button and then underline the second, i can't seem to find the right way to accomplish that. Any ideas how to do so?