PLEASE HELP Header will not declare outlets!!!!!????

Discussion in 'iOS Programming' started by tomgoodenough, Sep 11, 2010.

  1. tomgoodenough macrumors newbie

    Sep 10, 2010
    in my .h file i do:

    IBOutlet UIButton *button1;

    which works, but in my .m file when i try:

    [button1 setHidden:NO];

    button one has an error saying: "button1 not declared".

    previous outlets i have made are working fine in .m is it something i did? :(
  2. Thomas Harte macrumors 6502

    Nov 30, 2005
    Bound to be something you did, but it's difficult to tell what. Would it be possible to post the actual .h and .m files?
  3. tomgoodenough thread starter macrumors newbie

    Sep 10, 2010
    ok here they are:

    .m file:

    #import "SecondViewController.h"
    #import "ThirdViewController.h"
    @implementation SecondViewController
    @synthesize dmImage;
    -(IBAction)animatego {
    		NSTimer *animateTime = [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(animationFirst) userInfo:nil repeats:YES];
    - (void)animationFirst {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(animationSecond)];
    	[UIView setAnimationDuration:3.0];
    	dmImage.transform = CGAffineTransformMakeTranslation(0, -340);
    	dmImage.alpha = 1.0;
        [UIView commitAnimations];
    - (void)animationSecond {
        [UIView beginAnimations:nil context:NULL];
        //image down
        [UIView commitAnimations];
    -(IBAction)switchBack {
    	[self dismissModalViewControllerAnimated:YES];
    And .h file:

    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    @interface SecondViewController : UIViewController {
    	UIImageView *dmImage;
    	BOOL animated;
    	IBOutlet UILabel *label1;
    @property (nonatomic, retain) IBOutlet UIImageView *dmImage;

    I have been messing around with the files trying out different things with them but i seem to have gone wrong. Hope i can find out cos i really need this for a game!!!

  4. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset
    Post the code that has the problem.

    The problem you posted is with button1:
    The .h and .m you posted doesn't have any button1 in it anywhere.
    Therefore, that code can't be the cause of the problem.

Share This Page