上课似乎不起作用。不会返回图像

时间:2017-08-04 14:35:07

标签: ios objective-c

我对objective-c中的类很新。我正在测试一个我通过点击一个按钮从课堂上取下隐藏的图像,一切都编译并运行但是它不适合我,当我点击时没有任何显示。我做错了吗?试图将我认为与下面代码相关的所有内容都包括在内,显然这个类的其他部分的图像都在那里,但我没有将它们包含在下面,因为我只是测试了一个图像。

question.m文件 -

#import "Question.h"
@implementation Question
@synthesize image;

@end

question.h -

#import <UIKit/UIKit.h>
#import "ViewController.h"
#ifndef Question_h
#define Question_h
#endif /* Question_h */


@interface Question : NSObject
{
    UIImageView *image;
}

@property(nonatomic, retain) UIImageView *image;

@end

@class Question;
@interface Controller : NSObject
{
    Question *firstQuestion;
    Question *secondQuestion;
    Question *thirdQuestion;

}
@property(nonatomic, retain) Question *firstQuestion;
@property(nonatomic, retain) Question *secondQuestion;
@property(nonatomic, retain) Question *thirdQuestion;

-(void) Question;

ViewController.m -

#import "ViewController.h"
#import "Question.h"

@synthesize question1, q2, q3, firstaid;

- (void)viewDidLoad {
[super viewDidLoad];

 firstTierQuestions = [[NSMutableArray alloc] initWithCapacity:100];
}

- (IBAction)Question:(id)sender {
Question *firstQuestion = [[Question alloc] init];
firstQuestion.image = question1;
firstQuestion.a1 = _answer1;
firstQuestion.a2 = _answer2;

[firstTierQuestions addObject:firstQuestion];

- (IBAction)generator:(id)sender {

        for (Question *firstQuestion in firstTierQuestions) {
        [firstQuestion.image setHidden:NO];
    }
}

viewController.h -

#import "question.h"

@interface ViewController : UIViewController

{
    IBOutlet UIImageView *question1;  
    NSMutableArray *firstTierQuestions; 
}

@property (strong, nonatomic) IBOutlet UIButton *generator;
@property (strong, nonatomic) IBOutlet UIImageView *question1;

- (IBAction)generator:(id)sender;

@property (nonatomic, strong) NSObject *Question;

@end

0 个答案:

没有答案