ios - 关于 Property not found Xcode 5 错误

标签 ios objective-c xcode

这里是InformacionViewController.h:

 #import <UIKit/UIKit.h>
 #import "LibrosFenomenales.h"

 @interface InformacionViewController : UIViewController

 @property (strong, nonatomic) IBOutlet UILabel *nombre;
 @property (strong, nonatomic) IBOutlet UILabel *autor;
 @property (strong, nonatomic) IBOutlet UILabel *año;
 @property (strong, nonatomic) IBOutlet UILabel *genero;
 @property (strong, nonatomic) IBOutlet UITextView *argumento;
 @property (strong, nonatomic) IBOutlet UIImageView *portada;
 @property LibrosFenomenales *libroSeleccionado;

 @end

这里是ViewController.m:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   [tableView deselectRowAtIndexPath:indexPath animated:YES];

   InformacionViewController *informacionViewController = [self.storyboard        
   instantiateViewControllerWithIdentifier:@"InformacionViewController"];
   UINavigationController *navigationController = [[UINavigationController alloc]   
   initWithRootViewController:informacionViewController];

   informacionViewController.libroSeleccionado = [_libros objectAtIndex:indexPath.row];
   [self presentViewController:navigationController animated:YES completion:nil];
}

Xcode 向我显示此错误:在“InformacionViewController”类型的对象上找不到属性“libroSeleccionado”。

这是行:informacionViewController.libroSeleccionado = [_libros objectAtIndex:indexPath.row];

我做错了什么?

谢谢

最佳答案

您只需首先清理构建,而不是退出 Xcode。要清理构建,请按 command+Shift+K。然后运行该应用程序,如果它不起作用,那么试试这个 @property (strong, nonatomic) LibrosFenomenales *libroSeleccionado; 而不是@property LibrosFenomenales *libroSeleccionado;

关于ios - 关于 Property not found Xcode 5 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24434106/

相关文章:

ios - 如何在ios swift形式的控件之间添加控件

ios - 更改 SLComposeSheetConfigurationItem 的色调颜色/文本颜色

ios - Objective-C,边框颜色不适用于 UIColor

ios - Xcode 初学者;重用标识符?

json - 将本地字典复制到全局字典中

ios - 无法在 Swift 的 ViewController 类中创建子类的对象

iphone - 使用 NSPredicate 过滤核心属性和实体

ios - 如何让Uibutton被选中

objective-c - 为什么斯坦福的类(class)使用惰性初始化?

xcode - 对象不存在时 ABRecordCopyValue 不起作用