我剛剛開始在objective-c中編程,並且「使用未聲明的標識符'uneImage';您的意思是'_uneImage'?」。很多帖子都在談論這個問題,但我還沒有找到解決方案。iphone xCode使用未聲明的標識符
.H:
#import
@interface ViewController : UIViewController
{
UIImagePickerController *picker;
}
@property (weak, nonatomic) IBOutlet UIImageView *uneImage;
- (IBAction)album:(id)sender;
@end
.M
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
- (IBAction)album:(id)sender
{
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
uneImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end