Expected ':' before '.' token
I am getting the Expected ':' before '.' token error with this piece of code:
[SecondViewController.view setNeedsDisplay];
.h:
#import <UIKit/UIKit.h>
#define AS(A,B) [(A) stringByAppendingString:(B)]
开发者_如何学编程
@interface SecondViewController : UIViewController{
.m:
[SecondViewController.view setNeedsDisplay];
Any hints ?
And if your wondering i am trying to Refresh the view
I cannot see what SecondViewController
is.
So I can only answer: The class reference for NSView states that setNeedsDisplay:
ask for a BOOL
argument followed after the colon.
You are actually trying to access the Class object for your controller and not an instance object (which is what view property is defined on). Additionally setNeedsDisplay: needs a boolean parameter.
So either use this syntax if it's called from within the view controller:
[self.view setNeedsDisplay:YES];
Or this syntax if it's from somewhere else:
SecondViewController *myController;
...
[myController.view setNeedsDisplay:YES];
I'd check for a missing header file, is SecondViewController defined in this context?
@user393273: Can you also elaborate? It's hard to help with only one line of code to go on. For instance, can you give us the SecondViewController
header file - are you sure you're subclassing anything, for instance UIViewController? You should have something like @interface SecondViewController : UIViewController
in the header. And please give us the method in which you're calling the above line. Also, what are you setting the property needsDisplay
to?
The problem is from SecondViewController.
精彩评论