4.7. REAL-TIME LABS 123
values, and a way to retrieve the elements from the GUI are needed. Accessing GUI values are
briefly mentioned next.
To start, add the GUI elements. One will be able to select which system to plot by mod-
ifying the values in the array created in the last lab.
1. Replace the _plotPickerData elements with @”RC Circuit” and @”RL Circuit”. e
rest of the picker view code will work as is. is is modified in the ViewController.m file
and the viewDidLoad method.
2. To allow the AudioController to access GUI values, add the following lines to ViewCon-
troller.h within the @interface section.
@property (nonatomic, weak)
IBOutlet UITextField *RInput;
@property (nonatomic, weak)
IBOutlet UITextField *LInput;
@property (nonatomic, weak)
IBOutlet UITextField *CInput;
- (float) getRValue;
- (float) getLValue;
- (float) getCValue;
e UITextField pointers allow one to access the text field properties. e get{R,L,C} Value
methods allow the AudioController to retrieve the data as floats.
3. Populate the get{R,L,C} Value methods in ViewController.m. ese methods pull text
values entered, parse the string to a float, then return that value. ere is no other error
checking.
- (float) getRValue
{
NSString *strVal = _RInput.text;
return [[NSDecimalNumber decimalNumberWithString:(strVal)]
floatValue];
}
- (float) getLValue;
{
NSString *strVal = _LInput.text;
return [[NSDecimalNumber decimalNumberWithString:(strVal)]
floatValue];
}