dejoong
dejoong

Reputation: 2233

Request for member not a structure or union

i got a prob when i tried to set webview property on uiviewcontroller. here the code:

UIWebView:

@interface mainView : UIWebView { 
    int currentPage;
}
@property int currentPage;

and i synthesize on the implementation

UIViewController

(void)loadView {
    webview = [[mainView alloc]init];
    webview.currentPage = 2; // error -> Request for member "currentPage' in something not a structure or union
    self.view=webview;
    [webview release];
}

why i am unable to set the currentPage property?

Anyone know the solution so tat i can set currentPage on UIViewController?

Thanks.

Upvotes: 1

Views: 327

Answers (1)

Stuart
Stuart

Reputation: 37053

Is webview an instance of mainView (incidentally, class names should begin with a capital letter, so it should be MainView), or is it an instance of UIWebView. It looks like you have forgotten to declare webview as the correct class type, as the compiler isn't recognising that it has a property called currentPage.

Upvotes: 2

Related Questions