'colorchooser' undeclared
Okay so I'm super brand new to cocoa and I have one failed thing. It says 'colorchooser' undeclared on the first (colorchooser.selectedSegmentIndex == 0)I have no idea what's wrong!
//
// Flashbox2ViewController.m
// Flashbox2
//
// Created by Paxton Harman on 2/1/11.
// Copyright 2011 Santa Barbara City College. All rights reserved.
//
#import "Flashbox2ViewController.h"
@implementation Flashbox2ViewController
@synthesize colorChooser, sampleText;
-(IBAction) colorChanged {
if (colorchooser.selectedSegmentIndex == 0) sampleText.textColor = [UIColor blackColor];
if (colorchooser.selectedSegmentIndex == 1) sampleText.textColor = [UIColor blueColor];
if (colorchooser.selectedSegmentIndex == 2) sampleText.textColor =开发者_运维知识库 [UIColor redColor];
}
choose colorchooser or colorChooser
If you are making a @property of colorChooser and @synthesize it... then it is obvious that you should use colorChooser.selectedSegmentIndex and not colorchooser.selectedSegmentIndex...
Cheers
精彩评论