mercredi 23 décembre 2015

I am making a airline app with a book your ticket section and I want it to display the price of one way and round trip with a segment controller

My View Controller.

  1. My .h, DepartText is the Dubai textfield,Picker is pickerview,and Segment Control is segment control,SegmentText is price textfield, and Depart1 is again the Dubai textfield.

  2. So here I have the picker view row showing in the textfield.

  3. The DepartText gives an error, this is where I am confused. What should I do to make this the 1st textfield display the price in the next textfield. With the segment controller.

.h file-

@interface ViewController5 : UIViewController{
    IBOutlet UITextField *DepartText;
    IBOutlet UIPickerView *Picker;
    NSArray *PickerData;

}

@property (retain, nonatomic) IBOutlet UIPickerView *Picker;
@property (retain, nonatomic) IBOutlet NSArray *PickerData;
@property (weak, nonatomic) IBOutlet UISegmentedControl    *SegmentControl;
- (IBAction)SegmentButton:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *SegmentText;
@property (weak, nonatomic) IBOutlet UITextField *Depart1Text;


@end

.m file-

        if (select == 0) {
            DepartText.text = @"Abidjan,Côte d’Ivoire";
        } else
            if (select == 1) {
                DepartText.text = @"Abu Dhabi,UAE";


- (IBAction)SegmentButton:(id)sender {
}


- (IBAction)Depart:(id)sender {
    if ([self.Depart1Text.text  isEqual: @"Zürich,Switzerland"]) {
        self.SegmentText.text = @"$1731";
    }
}
@end

Aucun commentaire:

Enregistrer un commentaire