warning:
Autosynthesized property 'myVar' will use synthesized instance variable '_myVar', not existing instance variable 'myVar'.
@ Synthesize all my variables inside or have this warning in @ property inside of variables.
My. H file
# Import
@ Interface NavigationTripViewController: UIViewController{
NSArray * questionTitleTrip;
NSArray * questionDescTrip;
NSMutableArray * answerTrip;
NSMutableArray * pickerChoices;
int questionInt;
int totalInt;
IBOutlet UILabel * questionNum;
IBOutlet UILabel * questionTotalNum;
IBOutlet UILabel * recordType;
IBOutlet UITextView * questionDes;
IBOutlet UIView * answerView;
IBOutlet UIButton * preButton;
IBOutlet UIButton * nextButton;
UITextField * text;
UIPickerView * picker;
}
@ Property (retain, nonatomic) NSArray * questionTitleTrip;
@ Property (retain, nonatomic) NSArray * questionDescTrip;
@ Property (retain, nonatomic) NSMutableArray * answerTrip;
@ Property (retain, nonatomic) NSMutableArray * pickerChoices;
@ Property (retain, nonatomic) IBOutlet UILabel * questionNum;
@ Property (retain, nonatomic) IBOutlet UILabel * questionTotalNum;
@ Property (retain, nonatomic) IBOutlet UILabel * recordType;
@ Property (retain, nonatomic) IBOutlet UITextView * questionDes;
@ Property (retain, nonatomic) IBOutlet UIView * answerView;
@ Property (retain, nonatomic) IBOutlet UIButton * preButton;
@ Property (retain, nonatomic) IBOutlet UIButton * nextButton;
@ Property (retain, nonatomic) UITextField * text;
@ Property (retain, nonatomic) UIPickerView * picker;
- (IBAction) clickPre;
- (IBAction) clickNext;
@ End
My m file:
# import "NavigationTripViewController.h"
# Import
@ Interface NavigationTripViewController ()
@ End
@ Implementation NavigationTripViewController
@ Synthesize questionTitleTrip, questionDescTrip, answerTripl, pickerChoices, questionNum, questionTotalNum, recordType, questionDes, answerView, preButton, nextButton, text, picker;
- (Id) initWithNibName: (NSString *) nibNameOrNil bundle: (NSBundle *) nibBundleOrNil
{
self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil];
if (self) {
/ / Custom initialization
}
return self;
}
- (Void) viewDidLoad
{
[Super viewDidLoad];
/ / Do any additional setup after loading the view from its nib.
questionInt = 1;
questionTitleTrip = [[NSArray alloc] initWithObjects:
@ "",
@ "Record TYPE 4 - Trip Information",
Perhaps there is a warning for the sake questionInt, questionTitleTrip, NsArray not show relevant font color, just show black. This view is in a navigation have a view, I need to edit the category replaced the UIview classes themselves do, NavigationTripViewController? Thank you
Reply:
Their own roof bars .... hey ...
Reply:
@ Property (retain, nonatomic) NSArray * questionTitleTrip;
Wrote in a header file, the default will generate a _questionTitleTrip variable.
Therefore, to achieve the best written document.
@ Synthesize questionTitleTrip = _questionTitleTrip
Reply:
Then upstairs that define variables using the @ property ivar nothing but three cases
A) no synthetic @ synthesized, the system Autosynthesized synthesized by a _ivar
2) If you use @ synthesized ivar; claimed the variable ivar
3) If you use @ synthesized ivar = _ivar; then declared variables _ivar.
If you use self.ivar the three methods can be defined as self.ivar getter method is invoked.
Finally, the current recommendation is to define the method Apple 3) species. And no need to define a variable in the @ interface inside, if you need to define private variables, then you can. M using @ property definition. To say so much
No comments:
Post a Comment