Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tomgoodenough

macrumors newbie
Original poster
Sep 10, 2010
13
0
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? :(
 
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?
 
ok here they are:

.m file:


Code:
#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];
		

	
}

	
@end

And .h file:

Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>


@interface SecondViewController : UIViewController {
	
	UIImageView *dmImage;
	
	BOOL animated;
	
	IBOutlet UILabel *label1;

}

@property (nonatomic, retain) IBOutlet UIImageView *dmImage;

-(IBAction)switchBack;

-(IBAction)animatego;


@end


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!!!

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?

yse
 
Post the code that has the problem.

The problem you posted is with button1:
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".

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.