私はそれがUIImage
へのポインタである変数強いid変数をUIImage変数に転送するにはどうすればよいですか?
@property (strong, nonatomic) id dataObject;
を持っています。私は新しい変数にそれを送りたい。私は私の新しい変数にそれを送信するにはどうすればよい unrecognized selector sent to instance 0x68423b0
:
@property (nonatomic, retain) UIImage *theImage;
私はこの、このエラーでアプリがクラッシュをしようか?前もって感謝します。
contentViewController.h:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "pageAppViewController.h"
@class pageAppViewController;
@interface ViewController : UIViewController
{
NSArray *content;
UIImageView *theImageView;
UIImage *theImage;
}
@property (strong, nonatomic) IBOutlet UIImageView *theImageView;
@property (strong, nonatomic) id dataObject;
@property (nonatomic, retain) UIImage *theImage;
@end
contentViewController.m:あなたはid
として定義されたプロパティを持っている場合は
#import "ViewController.h"
#import "pageAppViewController.h"
@implementation ViewController
@synthesize theImageView, dataObject;
@synthesize theImage;
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
//this is the line that is causing the problems.
theImage = dataObject;
theImageView = [[UIImageView alloc] initWithImage: theImage];
[self.view addSubview:theImageView];
}
@end
これを試してください theImage =(UIImage *)dataObject; – IPaPa
ありがとうございますが、動作しませんでした。 – ctw