Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. - (void) removeFromMainViewAdditionalViews {
  2. if (fdv != nil) {
  3. [fdv removeFromSuperview];
  4. }
  5. if (tooLate != nil) {
  6. [tooLate removeFromSuperview];
  7. }
  8. }
  9.  
  10. - (void) setCellType:(PassengerCellType1)cellType{
  11. [self rightBigButtonHide:YES];
  12. [self removeFromMainViewAdditionalViews];
  13. NSString *newStatus = [self setRideStatusForType:cellType];
  14. UIColor *newColor = [self setBackgroundColorForBottomView:cellType];
  15.  
  16.  
  17. if (cellType == PassengerCellTypeFindDriver1) {
  18. fdv = [[[NSBundle mainBundle] loadNibNamed:@"FindDriver" owner:self options:nil] objectAtIndex:0];
  19. [fdv setTranslatesAutoresizingMaskIntoConstraints:NO];
  20. [self.mainView addSubview:fdv];
  21. NSDictionary *views = @{@"findDriver": fdv};
  22. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[findDriver]-0-|"
  23. options:0
  24. metrics:nil
  25. views:views]];
  26. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[findDriver]-0-|"
  27. options:0
  28. metrics:nil
  29. views:views]];
  30. } else if (cellType == PassengerCellTypeApproved1) {
  31. [self.rightButton setTitle:@"Chat" forState:UIControlStateNormal];
  32. [self.rightButton setTitleColor:RGBColor(0x1bd19f, 1) forState:UIControlStateNormal];
  33. [self.rightButton setType:CPAButtonTypeLightGreen];
  34. } else if (cellType == PassengerCellTypeEnRoute1) {
  35. [self rightBigButtonHide:NO];
  36. } else if (cellType == PassengerCellTypePending1) {
  37. sdv = [[[NSBundle mainBundle] loadNibNamed:@"SearchDriver" owner:self options:nil] objectAtIndex:0];
  38. [sdv setTranslatesAutoresizingMaskIntoConstraints:NO];
  39. [sdv setFrame:CGRectMake(0, 0, CGRectGetWidth(self.mainView.frame), 135)];
  40. [self.mainView addSubview:sdv];
  41. NSDictionary *views = @{@"searching": sdv, @"bottomView" : self.passBottomView};
  42. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[searching]-0-|"
  43. options:0
  44. metrics:nil
  45. views:views]];
  46. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[searching]-0-[bottomView]-0-|"
  47. options:0
  48. metrics:nil
  49. views:views]];
  50. } else if(cellType == PassengerCellTypeFinished1){
  51. [fdv setHidden:NO];
  52. [self.leftButton setHidden:YES];
  53. [self.rightBigButton setHidden:YES];
  54. [self.rightButton setHidden:YES];
  55. } else if (cellType == PassengerCellTypeTooLate1) {
  56. [tooLate setHidden:NO];
  57. tooLate = [[[NSBundle mainBundle] loadNibNamed:@"TooLate" owner:self options:nil] objectAtIndex:0];
  58. [tooLate setTranslatesAutoresizingMaskIntoConstraints:NO];
  59. [tooLate setFrame:CGRectMake(0, 0, CGRectGetWidth(self.mainView.frame), CGRectGetHeight(self.mainView.frame))];
  60. [self.mainView addSubview:tooLate];
  61. NSDictionary *views = @{@"tooLate": tooLate};
  62. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[tooLate]-0-|"
  63. options:0
  64. metrics:nil
  65. views:views]];
  66. [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[tooLate]-0-|"
  67. options:0
  68. metrics:nil
  69. views:views]];
  70.  
  71. }
  72. [self.status setText:newStatus];
  73. [self.passBottomView setBackgroundColor:newColor];
  74. _cellType = cellType;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement