声明的行动显然变得未宣布

时间:2012-03-30 08:18:52

标签: xcode3.2

我收到一条错误,告诉我的操作方法未声明 - 但我在头文件中提到了操作。

代码

  -(IBAction)doSomething:(id)sender

{

 UIActionSheet *actionSheet = [[UIActionSheet alloc]
 initWithTitle:@"Are you Sure?" 
 delegate:self
cancelButtonTitle:@"NO Way!" 
 destructiveButtonTitle:@"Yes I'm Sure"
  otherButtonTitles:nil];

[actionSheet showInView:self.view];
[actionSheet release];
   }

   -(void)actionSheet:(UIActionSheet *)actionSheet
    didDismissWithButtonIndex:(NSInteger)buttonIndex
   {
if (!buttonIndex == [actionSheet cancelButtonIndex]) {
    NSString *msg = nil;

if (nameField.text.length >0) {
    msg = [[NSString alloc] initWithFormat:@"You can breathe easy, %@,"EveryThing Went ok.",nameField.text];
        }
else {
    msg = @"You can Breathe easy , EveryThing Went Ok";
}
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something Was Done" message:msg delegate:nil cancelButtonTitle:@"Phew!" otherButtonTitles:nil];
    [alert Show];
    [alert release];
    [msg release];

}
 **- (IBAction)switchChanged:(id)sender
  {
UISwitch *whichSwitch = (UISwitch *)sender;
BOOL setting = whichSwitch.isOn;
[leftSwitch setOn:setting animated:YES];
[rightSwitch setOn:setting animated:YES];
 }**
  - (IBAction)toggleShowHide:(id)sender
  {
UISegmentedControl *segmentControl = (UISegmentedControl *)sender;
NSInteger segment = segmentControl.selectedSegmentIndex;
if (segment == kShowSegmentIndex )
    [switchView setHidden:NO];
else[switchView setHidden:YES];
 }

-(void)viewDidLoad {
    jmUIImage *buttonImageNormal = [UIImage imageNamed:@"White Button.png"];
    UIImage *stretchableButtonImageNormal = [buttonImageNormal
                                             stretchableImageWithLeftCapWidth:12 topCapHeight:0];
    [doSomethingButton setBackgroundImage:stretchableButtonImageNormal forState:UIControlStateNormal];
    UIImage *buttonImagePressed = [UIImage imageNamed:@"blueButton.png"];

    UIImage *stretchableButtonImagePressed = [buttonImagePressed
                                              stretchableImageWithLeftCapWidth:12 topCapHeight:0];
    [doSomethingButton setBackgroundImage:stretchableButtonImagePressed forState:UIControlStateHighlighted];
}
- (IBAction)sliderChanged:(id)sender
    {
UISlider *slider = (UISlider *)sender;
int progressAsInt = (int)(slider.value + 0.5f);
NSString *newText = [[NSString alloc] initWithFormat:@"%d",progressAsInt];
sliderLabel.text = newText;
[newText release];
  }

 -(IBAction)textFieldDoneEditing:(id)sender
{
[sender resignFirstResponder];
}

-(IBAction)backgroundClick:(id)sender
{
[nameField resignFirstResponder];
[numberField resignFirstResponder];
 }
- (void)didDealloc 
{
    [super dealloc];
}

  @end

switchChanged 方法中出现错误,错误是'switchChanged'undeclared(首次在此函数中使用)

0 个答案:

没有答案