This how I’m trying to add a property for my UIButton in Assistant Editor:
I Ctrl-drag from the button to the .h of my view controller window. A small box appears and I choose: Connection: Outlet, Name: favoriteButton, Type: UIButton, Storage: weak.
Then it makes the property in the header file in Assistant Editor, and adds a synthesize and nils it in the .m in Standard Editor.
But, no property is visible in my .h in Standard Editor, but the synthesize and nil is added in the .m. Is this right behaviour?
I also have these lines in my viewcontroller.m:
- (void)viewDidLoad
{
[super viewDidLoad];
if ([[selectedObject valueForKey:@"Favorite"] isEqual:@"Yes"]) {
[favoriteButton setImage:[UIImage imageNamed:@"favoritedItem.png"] forState:UIControlStateSelected];
[favoriteButton setSelected:YES];
favoriteButtonSelected = 1;
After making the connection in Assistan Editor, I’m still told that favoriteButton is an undeclared identifier in the viewDidLoad, also getting errors for the synthesize and nil. Can you tell me what I’m doing wrong?
1 Answer