Guest User

Untitled

a guest
Aug 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. How can I disable a UISegmentedControl?
  2. -(void)displayCheckMark
  3. {
  4. titleSegmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
  5. [titleSegmentedControl insertSegmentWithImage:[UIImage imageNamed:@"symbolbg.png"] atIndex:0 animated:YES];
  6. [titleSegmentedControl insertSegmentWithImage:[UIImage imageNamed:@"inwatchlist.png"] atIndex:1 animated:YES];
  7. [titleSegmentedControl addTarget:self action:@selector(titleBarButtonChanged:)forControlEvents:UIControlEventValueChanged];
  8. titleSegmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
  9. titleSegmentedControl.frame = CGRectMake(100,0,100,30);
  10. titleSegmentedControl.momentary = YES;
  11. titleSegmentedControl.tintColor = [UIColor blackColor];
  12. self.navigationItem.titleView = titleSegmentedControl;
  13.  
  14. [titleSegmentedControl setWidth:60 forSegmentAtIndex:0];
  15. [titleSegmentedControl setTitle:symbol forSegmentAtIndex:0];
  16. [titleSegmentedControl setWidth:30 forSegmentAtIndex:1];
  17. [titleSegmentedControl setEnabled:NO];
  18. }
  19.  
  20. - (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment;
  21.  
  22. titleSegmentedControl.userInteractionsEnabled = NO;
  23.  
  24. if(!sender.enabled) return;
  25.  
  26. [titleSegmentedControl setEnabled: NO];
Add Comment
Please, Sign In to add comment