tags:

views:

534

answers:

4

Hi

I have this error when i build my application iphone: request for member view in something not a structure or union on [CommuneSlider.view removeFromSuperview];

the code: - (void) CommuneSelected {

CommuneDetailsViewController *com = [[CommuneDetailsViewController alloc] initWithNibName:@"CommuneDetailsViewController" bundle:nil];

UINavigationController *navig = [[UINavigationController alloc] 
                               initWithRootViewController:com];
[self setCommuneDetails:(CommuneDetailsViewController *) navig];
[navig setNavigationBarHidden:YES];
[com release];
[navig release];


[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.8];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES];

[CommuneSlider.view removeFromSuperview];
[self.window addSubview:[CommuneDetails view]];

[UIView commitAnimations];

}

need HELP

A: 

If this were C++, I'd say "there's a pointer to a class, and you try to say pClass.foo instead of pClass->foo", or the type whose "view" variable you try to access is unknown due to some reason. Maybe this could help with Objective-C as well.

Semen Semenych
In fact it is in objective C and communeSlider is a property that I defined it in myAppDelegate@synthesize CommuneSlider;@synthesize CommuneDetails;
james
Well, is it a pointer or a struct/class? You see, I've seen these errors only in C++ context, and have little to no experience with Objective-C
Semen Semenych
A: 

In fact it is in objective C and communeSlider is a property that I defined it in myAppDelegate

@synthesize CommuneSlider; @synthesize CommuneDetails;

james
Please show the definition of CommuneSlider.
FenchKiss Dev
A: 

ok this is AzurGuideAppDelegate.h:

@class CommuneSliderController, AccueilViewController,CommuneDetailsViewController;

@interface AzurGuideAppDelegate : NSObject { UIWindow *window; AccueilViewController *AccueilController; CommuneSliderController *CommuneSlider; CommuneDetailsViewController *CommuneDetails; UINavigationController *navigationControl;

}

@property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet AccueilViewController *AccueilController; @property (nonatomic, retain) IBOutlet CommuneSliderController *CommuneSlider; @property (nonatomic, retain) IBOutlet CommuneDetailsViewController *CommuneDetails;

  • (void) goBack;
  • (void) goFront;
  • (void) CommuneSelected;

@end

and here the AzurGuideAppDelegate.m where i defined my method:

import "AzurGuideAppDelegate.h"

import "AccueilViewController.h"

@implementation AzurGuideAppDelegate

@synthesize window; @synthesize AccueilController; @synthesize CommuneSlider; @synthesize CommuneDetails;

  • (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Override point for customization after application launch

    [window addSubview:AccueilController.view]; [window makeKeyAndVisible]; }

  • (void) CommuneSelected {

    CommuneDetailsViewController *com = [[CommuneDetailsViewController alloc] initWithNibName:@"CommuneDetailsViewController" bundle:nil];

    UINavigationController *navig = [[UINavigationController alloc] initWithRootViewController:com]; [self setCommuneDetails:(CommuneDetailsViewController *) navig]; [navig setNavigationBarHidden:YES]; [com release]; [navig release];

    [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:.8]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:YES]; [CommuneSlider.view removeFromSuperview]; [self.window addSubview:[CommuneDetails view]];

    [UIView commitAnimations]; }

and my CommuneSliderController class:

import "AzurGuideAppDelegate.h"

import "CommuneSliderController.h"

import "CoverFlowView.h"

import "CoverViewController.h"

define CVC_VIEW_TAG 999

@implementation CommuneSliderController

  • (IBAction) goFront:(id) sender { AzurGuideAppDelegate *main = (AzurGuideAppDelegate *)[[UIApplication sharedApplication] delegate]; [main goFront]; }

    // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.

  • (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; }

// Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; contentView.backgroundColor = [UIColor whiteColor]; self.view = contentView; [contentView release]; [[UIApplication sharedApplication] setStatusBarHidden:YES];

CoverViewController *cvc = [[CoverViewController alloc] init];
cvc.view.tag = CVC_VIEW_TAG;

[self.view addSubview:cvc.view];

}

james
A: 

If this is the error line:

request for member view in something not a structure or union on [CommuneSlider.view removeFromSuperview];

It seems to indicate that CommuneSlider does not have a "view" member. The name of the variable makes me think it is a UIControl, not a sub-class of UIViewController (which would have a view property).

Are you sure you don't want something like:

[CommuneSliderController.view removeFromSuperview];
Chris