开发者

error: object cannot be set - either readonly property or no setter found

开发者 https://www.devze.com 2023-03-09 16:27 出处:网络
I\'m trying to call a window using the following code self.Modality = [[Modalities alloc]initWithNibName:@\"Modalities\" bundle:nil];

I'm trying to call a window using the following code

self.Modality = [[Modalities alloc]initWithNibName:@"Modalities" bundle:nil];

[self presentModalViewController开发者_JAVA百科:self.Modality animated:YES];

where modality is object of modalities (class)

I get the following errors

error: object cannot be set - either readonly property or no setter found error: accessing unknown 'Modality' getter method

any suggestion to solve that


Declare you Modality property as nonatomic retain but not readonly.

@property (nonatomic, retain) NSArray* Modality;

And use below in your .m files

@synthesize Modality;


Assuming you are refining your code of your previous question you've already set up the property correctly. I think you forgot to synthesize the accessor methods, add a

@synthesize Modality;

After

@implementation ...

NOTE

You should not begin the names your variables with a capital letter. It's common practice to use this for class names.

0

精彩评论

暂无评论...
验证码 换一张
取 消