Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void) removeFromMainViewAdditionalViews {
- if (fdv != nil) {
- [fdv removeFromSuperview];
- }
- if (tooLate != nil) {
- [tooLate removeFromSuperview];
- }
- }
- - (void) setCellType:(PassengerCellType1)cellType{
- [self rightBigButtonHide:YES];
- [self removeFromMainViewAdditionalViews];
- NSString *newStatus = [self setRideStatusForType:cellType];
- UIColor *newColor = [self setBackgroundColorForBottomView:cellType];
- if (cellType == PassengerCellTypeFindDriver1) {
- fdv = [[[NSBundle mainBundle] loadNibNamed:@"FindDriver" owner:self options:nil] objectAtIndex:0];
- [fdv setTranslatesAutoresizingMaskIntoConstraints:NO];
- [self.mainView addSubview:fdv];
- NSDictionary *views = @{@"findDriver": fdv};
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[findDriver]-0-|"
- options:0
- metrics:nil
- views:views]];
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[findDriver]-0-|"
- options:0
- metrics:nil
- views:views]];
- } else if (cellType == PassengerCellTypeApproved1) {
- [self.rightButton setTitle:@"Chat" forState:UIControlStateNormal];
- [self.rightButton setTitleColor:RGBColor(0x1bd19f, 1) forState:UIControlStateNormal];
- [self.rightButton setType:CPAButtonTypeLightGreen];
- } else if (cellType == PassengerCellTypeEnRoute1) {
- [self rightBigButtonHide:NO];
- } else if (cellType == PassengerCellTypePending1) {
- sdv = [[[NSBundle mainBundle] loadNibNamed:@"SearchDriver" owner:self options:nil] objectAtIndex:0];
- [sdv setTranslatesAutoresizingMaskIntoConstraints:NO];
- [sdv setFrame:CGRectMake(0, 0, CGRectGetWidth(self.mainView.frame), 135)];
- [self.mainView addSubview:sdv];
- NSDictionary *views = @{@"searching": sdv, @"bottomView" : self.passBottomView};
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[searching]-0-|"
- options:0
- metrics:nil
- views:views]];
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[searching]-0-[bottomView]-0-|"
- options:0
- metrics:nil
- views:views]];
- } else if(cellType == PassengerCellTypeFinished1){
- [fdv setHidden:NO];
- [self.leftButton setHidden:YES];
- [self.rightBigButton setHidden:YES];
- [self.rightButton setHidden:YES];
- } else if (cellType == PassengerCellTypeTooLate1) {
- [tooLate setHidden:NO];
- tooLate = [[[NSBundle mainBundle] loadNibNamed:@"TooLate" owner:self options:nil] objectAtIndex:0];
- [tooLate setTranslatesAutoresizingMaskIntoConstraints:NO];
- [tooLate setFrame:CGRectMake(0, 0, CGRectGetWidth(self.mainView.frame), CGRectGetHeight(self.mainView.frame))];
- [self.mainView addSubview:tooLate];
- NSDictionary *views = @{@"tooLate": tooLate};
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[tooLate]-0-|"
- options:0
- metrics:nil
- views:views]];
- [self.mainView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[tooLate]-0-|"
- options:0
- metrics:nil
- views:views]];
- }
- [self.status setText:newStatus];
- [self.passBottomView setBackgroundColor:newColor];
- _cellType = cellType;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement